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

rename confusing properties/flags #82

Merged
merged 7 commits into from
Feb 1, 2023

Conversation

agouin
Copy link
Member

@agouin agouin commented Feb 1, 2023

TLDR; Cleanup refactor, rename confusing config property keys/values and flags while retaining backwards compatibility

chains.yaml config changes:

  1. language in the chains.yaml config is confusing. This is used to indicate which dockerfile strategy should be used. We currently have dockerfiles for building cosmos sdk chains (renames covered in 2), cargo rust builds (renames covered in 3), imported docker images (imported), and simple images where we don't build anything but drop binaries/libraries in (none)
  2. language: go would make sense in chains.yaml if that were the scope of the build, but it has become more concise than that. Including the rename from 1, language: go becomes dockerfile: cosmos. Other permutations such as language: go, language: cosmos and dockerfile: go will also work, but will log out deprecation warnings. In a future release we can remove the deprecated keys/values.
  3. language: rust, similarly to 2, would also make sense if it were broad enough to build every rust project, but this is also not the case as it is not compatible with frameworks like nix and others. dockerfile: cargo is more applicable here. Same as 2, a deprecation warning will be logged if rust is used, but it will still work.

CLI flags changes:

  1. --version/-v flag is confusing as it does not well portray that it is both the git short ref used for the git checkout, but also used for deriving the resulting docker image tag. This flag has been renamed to --git-ref/-g. --version/-v can still be used, but a deprecation warning will be logged. If both flags are used, --git-ref will override.
  2. --tag/-t is a new optional flag introduced for overriding the resulting docker image tag. If not provided, the image tag will still be derived from the git ref.

Organizational changes:

HeighlinerBuilder introduced, and associated logic moved out of cmd/build.go. Code organized in build/ and cmd/

Log/flag changes:

  • --git-ref flag description updated to reflect that it is the git short ref (branch/tag)
  • --platform flag description updated to indicate that it only applies when using buildkit
  • Deprecation warning logs when old property key/values are in use

Copy link
Contributor

@DavidNix DavidNix left a comment

Choose a reason for hiding this comment

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

I was at first nervous at the large number of changes without test coverage, but I see that it's mostly copy/paste from existing, working code.

Was this manually QA'ed? If so, how extensive?

@@ -15,13 +15,13 @@ Please keep chains in alphabetical order.

`github-repo` -> The repo name of the location of the chain binary.

`language` -> Used in the Docker `FROM` argument to create a a docker base image. OPTIONS: "go, rust, nix, imported". Use "imported" if you are not able to build the chain binary from source and are importing a pre-made docker container.
`dockerfile` -> Which dockerfile strategy to use (folder names under dockerfile/). OPTIONS: `cosmos`, `cargo`, `imported`, or `none`. Use `imported` if you are importing an existing public docker image as a base for the heighliner image. Use `none` if you are not able to build the chain binary from source and need to download binaries into the image instead.
Copy link
Contributor

@DavidNix DavidNix Feb 1, 2023

Choose a reason for hiding this comment

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

What's the purpose and differences between Dockerfile, native.Dockerfile, local.Dockerfile? Is there any special handling to keep them all in sync?

Copy link
Member Author

@agouin agouin Feb 1, 2023

Choose a reason for hiding this comment

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

  • Dockerfile is for buildkit. it is not compatible with standard docker build due to FROM --platform=$BUILDPLATFORM which is necessary in buildkit builds to cross compile from an image on the machine's arch. This is the "production" use dockerfile.
  • native.Dockerfile is for non-buildkit builds on your local machine, without the -b flag. It will fetch the chain source from the remote git repository similar to the Dockerfile. This is used for building an local image from git source, which is good for things like a local test before making a PR for a chains.yaml addition, or debugging interchaintest cases.
  • local.Dockerfile is used when the --local flag is passed. This will use the current working directory for the chain source code and is mainly used for chain development flows as it does not require changes to be committed and pushed to the remote git repository to build

A contributor doc would be helpful to explain these differences to keep them in sync, as most changes should be made to all 3.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think all of that in the README would be excellent.

cmd/queue.go Outdated
Comment on lines 33 to 34
basicAuthUser := os.Getenv("GITHUB_USER")
basicAuthPassword := os.Getenv("GITHUB_PASSWORD")
Copy link
Contributor

@DavidNix DavidNix Feb 1, 2023

Choose a reason for hiding this comment

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

Should these env vars be surfaced in documentation somewhere?

Copy link
Member Author

@agouin agouin Feb 1, 2023

Choose a reason for hiding this comment

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

These were copy and pasted. I don't think they are used for anything though. I'd rather remove them than document them when they aren't tested. A PAT would be a much better auth mechanism anyway.

@agouin
Copy link
Member Author

agouin commented Feb 1, 2023

I was at first nervous at the large number of changes without test coverage, but I see that it's mostly copy/paste from existing, working code.
Was this manually QA'ed? If so, how extensive?

Yes, this is a lift and shift operation other than adding the new flags/keys/values, deprecation handling, and improved logging/docs/descriptions.

I ran through all of the supported use cases in the README. It would be great to get a test harness added to heighliner, I added an issue for that in #83

@agouin agouin merged commit 9406f6b into main Feb 1, 2023
@agouin agouin deleted the andrew/rename_properties_backwards_compatible branch February 1, 2023 17:30
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.

None yet

2 participants