Browse Source

Fix: adding back the possibility to add arbitrary labels

Arbitrary labels could be added as `make` parameter `LABEL=`, which is used in
att-comdev/cicd Jenkins pipelines.

Sample parameter:
'LABEL=org.label-schema.vcs-url=${GERRIT_CHANGE_URL} \
--label org.label-schema.base-image=${base_sha256}'

Sample usage:
See Jenkinsfile files under images/ directory in att-comdev/cicd repo.

In addition to that, if `COMMIT` variable is undefined when invoking `make`, we
use result of `git rev-parse HEAD` command, which should output latest git
commit ID.

[0] https://github.com/att-comdev/cicd

Change-Id: I9193ca03cb3970e3a3e1cb64ff643a4d24543636
Roman Gorshunov 6 months ago
parent
commit
2c09054c4b
2 changed files with 4 additions and 2 deletions
  1. 3
    1
      Makefile
  2. 1
    1
      tools/drydock_image_build.sh

+ 3
- 1
Makefile View File

@@ -22,7 +22,9 @@ PROXY           ?= http://proxy.foo.com:8000
22 22
 NO_PROXY        ?= localhost,127.0.0.1,.svc.cluster.local
23 23
 USE_PROXY       ?= false
24 24
 PUSH_IMAGE      ?= false
25
-COMMIT          ?= commit-id
25
+# use this variable for image labels added in internal build process
26
+LABEL           ?= org.airshipit.build=community
27
+COMMIT          ?= $(shell git rev-parse HEAD)
26 28
 IMAGE           ?= ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
27 29
 GO_BUILDER      ?= docker.io/golang:1.10-stretch
28 30
 

+ 1
- 1
tools/drydock_image_build.sh View File

@@ -22,7 +22,7 @@ then
22 22
   ADDL_BUILD_ARGS="${ADDL_BUILD_ARGS}| --build-arg PIP_TRUSTED_HOST=${PIP_TRUSTED_HOST}"
23 23
 fi
24 24
 
25
-docker build --network host -t ${IMAGE} \
25
+docker build --network host -t ${IMAGE} --label ${LABEL} \
26 26
   --label org.opencontainers.image.revision=${COMMIT} \
27 27
   --label org.opencontainers.image.created="$(date --rfc-3339=seconds --utc)" \
28 28
   --label org.opencontainers.image.title=${IMAGE_NAME} \

Loading…
Cancel
Save