-
Notifications
You must be signed in to change notification settings - Fork 12
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
feat(sage-monorepo): tag the images of a product with semver (ARCH-304) #2871
feat(sage-monorepo): tag the images of a product with semver (ARCH-304) #2871
Conversation
Option 1: Specifying the version using environment variableTask: "build-image": {
"executor": "@nx-tools/nx-container:build",
"options": {
"context": "apps/openchallenges/apex",
"metadata": {
"images": ["ghcr.io/sage-bionetworks/openchallenges-apex"],
"tags": [
"type=edge,branch=main",
"type=raw,value=local",
"type=raw,value=$OPENCHALLENGES_VERSION",
"type=sha"
]
},
"push": false
}
}, Output: $ export OPENCHALLENGES_VERSION=1.0.0
$ nx build-image openchallenges-apex
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ghcr.io/sage-bionetworks/openchallenges-apex 1.0.0 b38a869afd48 3 seconds ago 42.7MB
ghcr.io/sage-bionetworks/openchallenges-apex local b38a869afd48 3 seconds ago 42.7MB
ghcr.io/sage-bionetworks/openchallenges-apex sha-0ff75a9 b38a869afd48 3 seconds ago 42.7MB Warning The task Option 2: Specifying the version as a CLI optionsI tried the command below but I always get this array error. I can confirm that the key is correct "--metadata.tags" but I can't find a value that will be evaluated as an array. $ nx build-image openchallenges-apex --metadata.tags="type=raw,value=1.0.0"
> nx run openchallenges-apex:build-image --metadata.tags=type=raw,value=1.0.0
NX Property 'tags' does not match the schema. 'type=raw,value=1.0.0' should be a 'array'. Option 3: Specifying the version as an inline environment variableSimilar to Option 2 but passing the value as an inline - or even global - environment variable. This approach failed too. INPUT_METADATA_TAGS="type=raw,value=1.0.0" nx build-image openchallenges-apex Output: $ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ghcr.io/sage-bionetworks/openchallenges-apex local 803a07876a25 3 seconds ago 42.7MB
ghcr.io/sage-bionetworks/openchallenges-apex sha-fa8714c 803a07876a25 3 seconds ago 42.7MB Option 4: Specifying a task configuration when the environment variable is expected to exist (in CI workflow)This PR implements this approach. See the files changed. |
Contributes to https://sagebionetworks.jira.com/browse/ARCH-304
Changelog
configurations
to the taskopenchallenges-apex:build-image
openchallenges-apex:build-image
and tag the image with semver when a tag is pushed@nx-tools/*
packagesFuture PRs
References