curved-farmer-66180
02/13/2023, 12:51 PMdocker_image(
name="payhere_dashboard",
source="Dockerfile.dashboard",
repository="{build_args.REPOSITORY}",
registries=["----<http://.dkr.ecr.ap-northeast-2.amazonaws.com|.dkr.ecr.ap-northeast-2.amazonaws.com>"],
image_tags=["latest", "{build_args.GIT_COMMIT}"],
)
ci.yaml command
run: |
GIT_COMMIT=$(git rev-parse HEAD) ./pants publish \
--docker-build-args='[ \
"REGISTRY=${ECR_REGISTRY}", \
"GIT_COMMIT=${GIT_COMMIT}", \
"REPOSITORY=stg/dashboard", \
]' payhere/app_services/dashboard:dashboard
pants.toml
[docker]
build_args = ["IMAGE_TAG", "COMMIT_REF", "GIT_COMMIT"]
here is the error trace.
Engine traceback:
in `publish` goal
DockerImageTagValueError: Invalid value for the `image_tags` field of the `docker_image` target at payhere/app_services/dashboard:dashboard: '{build_args.GIT_COMMIT}'.
The placeholder 'GIT_COMMIT' is unknown. Try with one of: build_args, pants, tags.
curved-television-6568
02/13/2023, 1:23 PMThe build arg 'GIT_COMMIT' is undefined. Defined build args are: REGISTRY, REPOSITORY.
Here it is the value of the expanded `{build_arg.GIT_COMMIT}`that is ${GIT_COMMIT}
and that is what is unknown (and unintended too of course).
Your shell command in ci.yaml
uses single quotes and in single quotes env var substitution is disabled.curved-farmer-66180
02/13/2023, 1:28 PMcurved-television-6568
02/13/2023, 1:33 PM[docker].env
though (still name only)curved-television-6568
02/13/2023, 1:35 PM.pants.bootstrap
or else where)curved-farmer-66180
02/13/2023, 1:36 PMcurved-television-6568
02/13/2023, 1:38 PMcurved-farmer-66180
02/13/2023, 1:52 PMcurved-farmer-66180
02/13/2023, 1:52 PM# BUILD
docker_image(name="img", tags=[env("TAG", "default")])
this is also working?curved-farmer-66180
02/13/2023, 2:09 PM# .pants.bootstrap
# Ensure GIT_COMMIT is set and exported
: ${GIT_COMMIT:=$(git rev-parse HEAD)}
export GIT_COMMIT
docker_image(
name="dashboard",
source="Dockerfile.dashboard",
repository="{build_args.REPOSITORY}",
registries=["<http://168779575847.dkr.ecr.ap-northeast-2.amazonaws.com|168779575847.dkr.ecr.ap-northeast-2.amazonaws.com>"],
image_tags=["latest", "{build_args.GIT_COMMIT}"],
)
Engine traceback:
in `publish` goal
DockerImageTagValueError: Invalid value for the `image_tags` field of the `docker_image` target at payhere/app_services/dashboard:payhere_dashboard: '{build_args.GIT_COMMIT}'.
The placeholder 'GIT_COMMIT' is unknown. Try with one of: build_args, pants, tags.
still the same...curved-television-6568
02/13/2023, 2:15 PMcurved-farmer-66180
02/13/2023, 2:27 PMecho $COMMIT_REF
./pants publish \
--docker-build-args='[ \
"REGISTRY=${ECR_REGISTRY}", \
"COMMIT_REF=${COMMIT_REF}", \
"REPOSITORY=stg/payhere-dashboard", \
]' payhere/app_services/dashboard:payhere_dashboard
shell: /usr/bin/bash -e {0}
env:
COMMIT_REF: 0b51931d0bee432e67f3e0ea6c9b305baad5c9c4
Although I changed to COMMIT_REF, I got similar error.
Engine traceback:
in `publish` goal
DockerImageTagValueError: Invalid value for the `image_tags` field of the `docker_image` target at payhere/app_services/dashboard:payhere_dashboard: '{build_args.COMMIT_REF}'.
The placeholder 'COMMIT_REF' is unknown. Try with one of: build_args, pants, tags.
curved-farmer-66180
02/13/2023, 2:35 PMcurved-television-6568
02/13/2023, 2:58 PMcurved-farmer-66180
02/13/2023, 3:26 PM2.15.0rc3
It is not stable version as well. But I heard the stable version is coming soon.curved-television-6568
02/13/2023, 3:32 PMcurved-farmer-66180
02/13/2023, 3:57 PM