diff --git a/.circleci/config.yml b/.circleci/config.yml index ef91144..b21946f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,4 +42,4 @@ workflows: requires: [orb-tools/publish] filters: tags: - only: /.*/ \ No newline at end of file + only: /.*/ diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index 7dc8138..c2387e4 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -29,7 +29,8 @@ promotion_requires: &promotion_requires test-macos-old, test-machine-latest, test-machine-old, - test-build-command-workspace + test-build-command-workspace, + test-build-with-args ] filters: &filters @@ -179,6 +180,17 @@ jobs: ls exit 1 fi + test-build-with-args: + docker: + - image: cimg/base:stable + steps: + - checkout + - setup_remote_docker + - docker/build: + dockerfile: test3.Dockerfile + image: cpeorbtesting/docker-orb-test + tag: $CIRCLE_BUILD_NUM-$CIRCLE_SHA1 + extra_build_args: --build-arg COMMIT_HASH=$CIRCLE_SHA1 test-dockerlint: docker: - image: cimg/node:17.7.2 @@ -221,6 +233,8 @@ workflows: requires: - test-create-workspace filters: *filters + - test-build-with-args: + filters: *filters # begin test-check-command - test-check-command: diff --git a/src/commands/build.yml b/src/commands/build.yml index 9d4fd1c..decf3fc 100644 --- a/src/commands/build.yml +++ b/src/commands/build.yml @@ -112,6 +112,11 @@ steps: steps: - run: echo 'export DOCKER_BUILDKIT=1' >> $BASH_ENV + - when: + condition: <> + steps: + - run: echo 'PARAM_EXTRA_BUILD_ARGS="<>"' >> $BASH_ENV + - when: condition: <> steps: @@ -126,7 +131,6 @@ steps: PARAM_DOCKER_CONTEXT: <> PARAM_DOCKERFILE_NAME: <> PARAM_DOCKERFILE_PATH: <> - PARAM_EXTRA_BUILD_ARGS: <> PARAM_IMAGE: <> PARAM_REGISTRY: <> PARAM_TAG: <> diff --git a/test3.Dockerfile b/test3.Dockerfile new file mode 100644 index 0000000..e0d8db5 --- /dev/null +++ b/test3.Dockerfile @@ -0,0 +1,22 @@ +# vim:set ft=dockerfile: +# +# The Ubuntu-based CircleCI Docker Image. Only use Ubuntu Long-Term Support +# (LTS) releases. + +FROM ubuntu:18.04 + +LABEL maintainer="CircleCI " + +ARG COMMIT_HASH + +# Change default shell from Dash to Bash +RUN rm /bin/sh && ln -s /bin/bash /bin/sh + +RUN if [[ "${COMMIT_HASH}" =~ ^[0-9a-f]{5,40}$ ]]; then \ + echo "Success: COMMIT_HASH is valid commit hash"; \ + else \ + echo "Error: COMMIT_HASH is invalid commit hash"; \ + exit 1; \ + fi + +WORKDIR /root/project