From d06f98690f68b7f8a79821f20acee21a19938109 Mon Sep 17 00:00:00 2001 From: Mikko Ylinen Date: Tue, 27 Aug 2019 10:43:46 +0300 Subject: [PATCH] images: tag with intel prefix In preparations to get some of the images to hub.docker.com/intel, start using intel/ prefix. Moreover, set the Makefile variables so that the images built by make [images|demos] can easily be pushed to any registry/org by 'docker push' (e.g., by Jenkins). Signed-off-by: Mikko Ylinen --- Makefile | 9 ++++++--- build/docker/build-image.sh | 9 +++++---- demo/build-image.sh | 18 ++++++++++-------- .../fpga_admissionwebhook/deployment-tpl.yaml | 2 +- deployments/fpga_plugin/fpga_plugin.yaml | 4 ++-- deployments/gpu_plugin/gpu_plugin.yaml | 2 +- .../crypto-perf-dpdk-pod-requesting-qat.yaml | 2 +- deployments/qat_plugin/qat_plugin.yaml | 2 +- .../qat_plugin/qat_plugin_kernel_mode.yaml | 2 +- 9 files changed, 28 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index bb159fc2..ef556791 100644 --- a/Makefile +++ b/Makefile @@ -41,19 +41,22 @@ build: $(cmds) clean: @for cmd in $(cmds) ; do pwd=$(shell pwd) ; cd cmd/$$cmd ; $(GO) clean ; cd $$pwd ; done -TAG?=$(shell git rev-parse HEAD) +ORG?=intel +REG?=$(ORG)/ +TAG?=devel +export TAG images = $(shell ls build/docker/*.Dockerfile | sed 's/.*\/\(.\+\)\.Dockerfile/\1/') $(images): - @build/docker/build-image.sh $@ $(BUILDER) + @build/docker/build-image.sh $(REG)$@ $(BUILDER) images: $(images) demos = $(shell cd demo/ && ls -d */ | sed 's/\(.\+\)\//\1/g') $(demos): - @cd demo/ && ./build-image.sh $@ $(BUILDER) + @cd demo/ && ./build-image.sh $(REG)$@ $(BUILDER) demos: $(demos) diff --git a/build/docker/build-image.sh b/build/docker/build-image.sh index 54074881..bf2fb00b 100755 --- a/build/docker/build-image.sh +++ b/build/docker/build-image.sh @@ -3,7 +3,7 @@ IMG=$1 BUILDER=$2 -DOCKERFILE="$(dirname $0)/${IMG}.Dockerfile" +DOCKERFILE="$(dirname $0)/$(basename ${IMG}).Dockerfile" if [ -z "$IMG" ]; then (>&2 echo "Usage: $0 ") @@ -15,14 +15,15 @@ if [ ! -e "${DOCKERFILE}" ]; then exit 1 fi -TAG=$(git rev-parse HEAD) +TAG=${TAG:-devel} +SRCREV=$(git rev-parse HEAD) if [ -z "${BUILDER}" -o "${BUILDER}" = 'docker' ] ; then docker build --pull -t ${IMG}:${TAG} -f ${DOCKERFILE} . - docker tag ${IMG}:${TAG} ${IMG}:devel + docker tag ${IMG}:${TAG} ${IMG}:${SRCREV} elif [ "${BUILDER}" = 'buildah' ] ; then buildah bud --pull-always -t ${IMG}:${TAG} -f ${DOCKERFILE} . - buildah tag ${IMG}:${TAG} ${IMG}:devel + buildah tag ${IMG}:${TAG} ${IMG}:${SRCREV} else (>&2 echo "Unknown builder ${BUILDER}") exit 1 diff --git a/demo/build-image.sh b/demo/build-image.sh index 58dbcad3..0a18ae16 100755 --- a/demo/build-image.sh +++ b/demo/build-image.sh @@ -2,26 +2,28 @@ IMG=$1 BUILDER=$2 +DIR=$(basename $IMG) -if [ -z "$IMG" ]; then +if [ -z "$DIR" ]; then (>&2 echo "Usage: $0 ") exit 1 fi -if [ ! -d "$IMG" ]; then - (>&2 echo "Directory $IMG doesn't exist") +if [ ! -d "$DIR" ]; then + (>&2 echo "Directory $DIR doesn't exist") exit 1 fi CWD=`dirname $0` -TAG=`git rev-parse HEAD` +TAG=${TAG:-devel} +SRCREV=$(git rev-parse HEAD) if [ -z "$BUILDER" -o "$BUILDER" = 'docker' ] ; then - docker build --rm -t ${IMG}:${TAG} "$CWD/$IMG/" - docker tag ${IMG}:${TAG} ${IMG}:devel + docker build --pull -t ${IMG}:${TAG} "$CWD/$DIR/" + docker tag ${IMG}:${TAG} ${IMG}:${SRCREV} elif [ "$BUILDER" = 'buildah' ] ; then - buildah bud -t ${IMG}:${TAG} "$CWD/$IMG/" - buildah tag ${IMG}:${TAG} ${IMG}:devel + buildah bud --pull-always -t ${IMG}:${TAG} "$CWD/$DIR/" + buildah tag ${IMG}:${TAG} ${IMG}:${SRCREV} else (>&2 echo "Unknown builder $BUILDER") exit 1 diff --git a/deployments/fpga_admissionwebhook/deployment-tpl.yaml b/deployments/fpga_admissionwebhook/deployment-tpl.yaml index d8a64fb1..760d4ce8 100644 --- a/deployments/fpga_admissionwebhook/deployment-tpl.yaml +++ b/deployments/fpga_admissionwebhook/deployment-tpl.yaml @@ -13,7 +13,7 @@ spec: spec: containers: - name: fpga-mutator - image: intel-fpga-admissionwebhook:devel + image: intel/intel-fpga-admissionwebhook:devel imagePullPolicy: IfNotPresent args: - -tls-cert-file=/etc/webhook/certs/cert.pem diff --git a/deployments/fpga_plugin/fpga_plugin.yaml b/deployments/fpga_plugin/fpga_plugin.yaml index 3ba7c357..4d393f7c 100644 --- a/deployments/fpga_plugin/fpga_plugin.yaml +++ b/deployments/fpga_plugin/fpga_plugin.yaml @@ -17,7 +17,7 @@ spec: serviceAccountName: intel-fpga-plugin-controller initContainers: - name: intel-fpga-initcontainer - image: intel-fpga-initcontainer:devel + image: intel/intel-fpga-initcontainer:devel imagePullPolicy: IfNotPresent volumeMounts: - mountPath: /opt/intel/fpga-sw @@ -31,7 +31,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.nodeName - image: intel-fpga-plugin:devel + image: intel/intel-fpga-plugin:devel imagePullPolicy: IfNotPresent volumeMounts: - name: devfs diff --git a/deployments/gpu_plugin/gpu_plugin.yaml b/deployments/gpu_plugin/gpu_plugin.yaml index 70b1432d..12542d53 100644 --- a/deployments/gpu_plugin/gpu_plugin.yaml +++ b/deployments/gpu_plugin/gpu_plugin.yaml @@ -21,7 +21,7 @@ spec: valueFrom: fieldRef: fieldPath: spec.nodeName - image: intel-gpu-plugin:devel + image: intel/intel-gpu-plugin:devel imagePullPolicy: IfNotPresent volumeMounts: - name: devfs diff --git a/deployments/qat_dpdk_app/base/crypto-perf-dpdk-pod-requesting-qat.yaml b/deployments/qat_dpdk_app/base/crypto-perf-dpdk-pod-requesting-qat.yaml index 72554769..a0f1c87b 100644 --- a/deployments/qat_dpdk_app/base/crypto-perf-dpdk-pod-requesting-qat.yaml +++ b/deployments/qat_dpdk_app/base/crypto-perf-dpdk-pod-requesting-qat.yaml @@ -5,7 +5,7 @@ metadata: spec: containers: - name: crypto-perf - image: crypto-perf:devel + image: intel/crypto-perf:devel imagePullPolicy: IfNotPresent command: [ "/bin/bash", "-c", "--" ] args: [ "while true; do sleep 300000; done;" ] diff --git a/deployments/qat_plugin/qat_plugin.yaml b/deployments/qat_plugin/qat_plugin.yaml index 674d0b72..d55955e6 100644 --- a/deployments/qat_plugin/qat_plugin.yaml +++ b/deployments/qat_plugin/qat_plugin.yaml @@ -15,7 +15,7 @@ spec: spec: containers: - name: intel-qat-plugin - image: intel-qat-plugin:devel + image: intel/intel-qat-plugin:devel env: - name: DPDK_DRIVER valueFrom: diff --git a/deployments/qat_plugin/qat_plugin_kernel_mode.yaml b/deployments/qat_plugin/qat_plugin_kernel_mode.yaml index 177a6eac..177556dd 100644 --- a/deployments/qat_plugin/qat_plugin_kernel_mode.yaml +++ b/deployments/qat_plugin/qat_plugin_kernel_mode.yaml @@ -17,7 +17,7 @@ spec: - name: intel-qat-kernel-plugin securityContext: privileged: true - image: intel-qat-plugin:devel + image: intel/intel-qat-plugin:devel imagePullPolicy: IfNotPresent command: ["/usr/bin/intel_qat_device_plugin", "-mode", "kernel"] volumeMounts: