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

Fix docker bake tagging #782

Merged
merged 12 commits into from
Oct 3, 2024
Merged

Fix docker bake tagging #782

merged 12 commits into from
Oct 3, 2024

Conversation

pschork
Copy link
Contributor

@pschork pschork commented Oct 2, 2024

Why are these changes needed?

Checks

  • I've made sure the lint is passing in this PR.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • I've checked the new test coverage and the coverage percentage didn't drop.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

@pschork pschork requested review from dmanc and samlaf October 3, 2024 21:07
@pschork pschork force-pushed the pschork/fix_docker_bake_tagging branch from a8a9b64 to 12e4f78 Compare October 3, 2024 21:10
@pschork pschork force-pushed the pschork/fix_docker_bake_tagging branch from 49a1567 to e73cdf5 Compare October 3, 2024 21:48
docker-bake.hcl Outdated
Comment on lines 18 to 23
variable "GIT_SHA" {
default = "$GIT_SHA"
}

variable "GIT_SHORT_SHA" {
default = "$GIT_SHORT_SHA"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These defaults are designed to fail (via invalid tag format) if someone tries to bake a release target without exporting GIT_SHA or GIT_SHORT_SHA env variables

docker buildx bake internal-release
[+] Building 0.1s (1/1) FINISHED                                                                                                                                                                                docker:desktop-linux
 => [internal] load local bake definitions                                                                                                                                                                                      0.0s
 => => reading docker-bake.hcl 5.14kB / 5.14kB                                                                                                                                                                                  0.0s
ERROR: invalid tag "ghcr.io/eigenda-traffic-generator:$GIT_SHA": invalid reference format

without a default, the build will still fail, but error message is harder to grok what the issue is.

docker buildx bake internal-release
[+] Building 0.1s (1/1) FINISHED                                                                                                                                                                                docker:desktop-linux
 => [internal] load local bake definitions                                                                                                                                                                                      0.0s
 => => reading docker-bake.hcl 5.14kB / 5.14kB                                                                                                                                                                                  0.0s
ERROR: invalid tag "ghcr.io/eigenda-traffic-generator:": invalid reference format

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prob add this as a comment above the variables themselves for documentation. Otherwise I can see myself reading this and being super confused wondering where/how this variable is defined and used.

SEMVER := $(shell basename $(CURDIR))
else
GITCOMMIT := $(shell git rev-parse --short HEAD)
GITDATE := $(shell git log -1 --format=%cd --date=unix)
GITSHA := $(shell git rev-parse HEAD)
BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed 's/[^[:alnum:]\.\_\-]/-/g')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: this sanitizes the branch name to conform with docker tagging syntax rules.

@pschork pschork marked this pull request as ready for review October 3, 2024 21:55
Copy link
Contributor

@dmanc dmanc left a comment

Choose a reason for hiding this comment

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

lgtm :shipit:

docker-bake.hcl Outdated

# Internal devops builds
group "internal-release" {
targets = ["node-internal", "batcher-release", "disperser-release", "encoder-release", "retriever-release", "churner-release", "dataapi-release", "traffic-generator-release"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it node-internal and not node-release?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

node-release was already used for public node releases and is incompatible with internal release targets.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll rename node-internal-release

Copy link
Contributor

Choose a reason for hiding this comment

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

also confused. is it because node-release is already something separate which builds with the arm target?

Should we call all the other internal-release targets xxx-internal instead of release then? Especially if those things are only internal, why call them release?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also confused. is it because node-release is already something separate which builds with the arm target?

it's because the existing node-release is incompatible with out internal release tagging.

target "node-release" {
  inherits = ["node", "_release"]
  tags     = ["${REGISTRY}/${REPO}/opr-node:${BUILD_TAG}"]
}
target "node-internal-release" {
  inherits = ["node"]
  tags       = ["${REGISTRY}/eigenda-node:${BUILD_TAG}",
                "${REGISTRY}/eigenda-node:${GIT_SHA}",
                "${REGISTRY}/eigenda-node:sha-${GIT_SHORT_SHA}",
               ]
}

Should we call all the other internal-release targets xxx-internal instead of release then? Especially if those things are only internal, why call them release?

Definitely agree that "release" is way overloaded. I'll rename

@pschork pschork merged commit 236141e into master Oct 3, 2024
9 checks passed
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