Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overall code health improvements #187

Merged
merged 35 commits into from
Aug 26, 2019
Merged

Overall code health improvements #187

merged 35 commits into from
Aug 26, 2019

Conversation

jetersen
Copy link
Contributor

Had to rewrite most of SSLUtils only to figure out much later it was because Travis/Github CI had issues with whether the container or java had created the ssl folder used for passing files around.

For code style, I still have some issues.
The com.bettercloud.vault.json package is mostly written in 2 spacing while the rest is written in 4 spacing.

Personally, I would switch to 4 spacing and 4 continuation spacing instead of 8 for continuation spacing.

final Vault vault = container.getVault(NONROOT_TOKEN);
vault.logical().list("secret/null");
List<String> list = vault.logical().list("secret/null");
assertEquals(list.size(), 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bklawans not sure this is desirable, see #176 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since @steve-perkins bumped the major version and I have fixed up CI. Let's go crazy and break the API 😆

Copy link
Contributor Author

@jetersen jetersen Aug 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getListData seems responsible to me as you already have getData but list is not the same as read so perhaps we need a new response class.

container = new GenericContainer("postgres:11.3-alpine")
super("postgres:11.3-alpine");
this.withNetwork(CONTAINER_NETWORK)
.withNetworkAliases(hostname)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should fix up the database networking problem the two merges created. @denglertai @steve-perkins

runCommand("vault", "login", "-ca-cert=" + CONTAINER_CERT_PEMFILE, rootToken);

runCommand("sh", "-c", "cat <<EOL >> " + CONTAINER_CLIENT_CERT_PEMFILE + "\n" + cert + "\nEOL");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running on CI against Travis or Github it seems the vault container's uid/gid is the only one with permissions to this file.

Copy link
Contributor Author

@jetersen jetersen Aug 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@steve-perkins I would recommend Travis CI for this repo once this PR is merged.
Otherwise, GitHub Action CI will soon be generally available.

GitHub Actions is generally available on November 13

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current CI runs are both available here: https://github.com/casz/vault-java-driver/runs/202654214

@bklawans
Copy link

bklawans commented Aug 25, 2019 via email

@bklawans
Copy link

bklawans commented Aug 25, 2019 via email

@bklawans
Copy link

bklawans commented Aug 25, 2019 via email

@jetersen
Copy link
Contributor Author

Feel free to send a PR to my branch @bklawans 😓
That way it gets tested on CI at least 😆

@bklawans
Copy link

bklawans commented Aug 25, 2019

@Casz Do you mean casz:chore/overallCodeHealth instead of BetterCloud/master?

@jetersen
Copy link
Contributor Author

Yup casz:chore/overallCodeHealth otherwise I would have to do the whole merge dance and I already did plenty to cleanup commit history. 😆

@bklawans
Copy link

Will do. I'm walking out the door now, but will turn that around this evening (Pacific time zone...)

@jetersen
Copy link
Contributor Author

In no hurry :)

@bklawans
Copy link

New PR issued to merge my changes to your branch, and I revoked the PR to the main BetterCloud repo.

…de can be checked. Added new method getListData() to LogicalResult
@jetersen
Copy link
Contributor Author

Cheers @bklawans :)
I wonder though @steve-perkins if you would prefer if we keep the old method with @deprecated

@bklawans
Copy link

I thought about that, but since the only difference is the return type we can't have both the old and the new method, since Java doesn't consider the return type to be part of the method signature. We will have to rename the new method if we want to keep the old.

@jetersen
Copy link
Contributor Author

jetersen commented Aug 26, 2019

Right the will bump to v5 and see compile issues 😊 I can live with that

@jetersen
Copy link
Contributor Author

Fixing the merge conflict 😅

@jetersen
Copy link
Contributor Author

If you want me to squash/rebase/rewrite history before merging please say so :)

@steve-perkins
Copy link
Contributor

Ehh... the intermingling of getListData(...) from @bklawans work, and the other general code cleanup, is a little confusing to sort through. But a squash won't help that. I think this is good.

@steve-perkins steve-perkins merged commit 709b815 into BetterCloud:master Aug 26, 2019
@jetersen
Copy link
Contributor Author

@steve-perkins would you mind enabling Travis so we can have CI on pull requests 😄

@jetersen jetersen deleted the chore/overallCodeHealth branch August 26, 2019 19:08
@steve-perkins
Copy link
Contributor

Post-merge, the integration test LogicalTests.testListPermissionDeniedReturnedByVault() is failing, because it's expecting a 404 response code from Vault instead of a 403.

In context, I assume this has to be a typo. I'll change the expected response to 403.

@jetersen
Copy link
Contributor Author

3231da3 definitely a typo honestly missed that in the merge.

@steve-perkins
Copy link
Contributor

Looking into that now. Virtually all of my recent-enough-to-be-relevant CI experience is with Jenkins, so Travis is a bit unfamiliar.

@jetersen
Copy link
Contributor Author

You just need to enable it. I already added a .travis.yml file for you in this PR.
https://github.com/marketplace/travis-ci FYI free for open source.

@steve-perkins
Copy link
Contributor

Incredibly frustrating. I believe that Travis is choking on the fact that this repository is owned by an organization. I've gone through all of the commonly-recommended troubleshooting steps (e.g. making sure that my membership in the organization is set to publicly visible). But the repo is still not available for Travis to use.

I'm going to call it a day, and start cutting a release for Maven Central. I may ping Travis support tomorrow. I've also signed up for the beta of GitHub's native CI system. That sign-up request is still pending, but anyone is welcome to write a ci.yaml for that if they like.

@steve-perkins
Copy link
Contributor

Version 5.0.0 has been published, and should appear on Maven Central within the next few hours.

@jetersen
Copy link
Contributor Author

@steve-perkins the PR already added a GitHub CI file: https://github.com/BetterCloud/vault-java-driver/blob/master/.github/workflows/gradle.yml

As for you issue enabling Travis, it could be that the project is actually still on travis-ci.org the open-source one and has yet to be migrated to travis-ci.com

So if you head here: https://travis-ci.org/BetterCloud/vault-java-driver you should be able to get it the needed permissions/

Here is the Travis announcement for travis-ci.org moving to travis-ci.com 😓
https://docs.travis-ci.com/user/migrate/open-source-on-travis-ci-com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants