Skip to content

Commit 0cda452

Browse files
authored
Merge pull request #207 from mythi/lock-versions
Prepare for image publishing
2 parents 5702977 + b6a7408 commit 0cda452

File tree

13 files changed

+127
-26
lines changed

13 files changed

+127
-26
lines changed

Jenkinsfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pipeline {
77
}
88
environment {
99
GO111MODULE="on"
10+
REG = "cloud-native-image-registry.westus.cloudapp.azure.com/"
1011
RUNC_VERSION="v1.0.0-rc8"
1112
CRIO_VERSION="v1.14.6"
1213
BUILDAH_VERSION="v1.10.0"
@@ -134,4 +135,16 @@ pipeline {
134135
}
135136
}
136137
}
138+
post {
139+
success {
140+
script {
141+
if (env.CHANGE_ID == null) {
142+
withDockerRegistry([ credentialsId: "57e4a8b2-ccf9-4da1-a787-76dd1aac8fd1", url: "https://${REG}" ]) {
143+
sh "make images PUSH=1"
144+
sh "make demos PUSH=1"
145+
}
146+
}
147+
}
148+
}
149+
}
137150
}

Makefile

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,35 @@ build: $(cmds)
4141
clean:
4242
@for cmd in $(cmds) ; do pwd=$(shell pwd) ; cd cmd/$$cmd ; $(GO) clean ; cd $$pwd ; done
4343

44-
TAG?=$(shell git rev-parse HEAD)
44+
ORG?=intel
45+
REG?=$(ORG)/
46+
TAG?=devel
47+
export TAG
4548

4649
images = $(shell ls build/docker/*.Dockerfile | sed 's/.*\/\(.\+\)\.Dockerfile/\1/')
4750

4851
$(images):
49-
@build/docker/build-image.sh $@ $(BUILDER)
52+
ifndef PUSH
53+
@build/docker/build-image.sh $(REG)$@ $(BUILDER)
54+
else
55+
@docker push $(REG)$@
56+
endif
5057

5158
images: $(images)
5259

5360
demos = $(shell cd demo/ && ls -d */ | sed 's/\(.\+\)\//\1/g')
5461

5562
$(demos):
56-
@cd demo/ && ./build-image.sh $@ $(BUILDER)
63+
ifndef PUSH
64+
@cd demo/ && ./build-image.sh $(REG)$@ $(BUILDER)
65+
else
66+
@docker push ${REG}$@
67+
endif
5768

5869
demos: $(demos)
5970

71+
lock-images:
72+
@scripts/update-clear-linux-base.sh clearlinux/golang:latest $(shell ls build/docker/*.Dockerfile)
73+
@scripts/update-clear-linux-base.sh clearlinux:latest $(shell find demo -name Dockerfile)
6074

61-
.PHONY: all format vet cyclomatic-check test lint build images $(cmds) $(images)
75+
.PHONY: all format vet cyclomatic-check test lint build images $(cmds) $(images) lock-images

build/docker/build-image.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
IMG=$1
44
BUILDER=$2
55

6-
DOCKERFILE="$(dirname $0)/${IMG}.Dockerfile"
6+
DOCKERFILE="$(dirname $0)/$(basename ${IMG}).Dockerfile"
77

88
if [ -z "$IMG" ]; then
99
(>&2 echo "Usage: $0 <Dockerfile>")
@@ -15,14 +15,15 @@ if [ ! -e "${DOCKERFILE}" ]; then
1515
exit 1
1616
fi
1717

18-
TAG=$(git rev-parse HEAD)
18+
TAG=${TAG:-devel}
19+
SRCREV=$(git rev-parse HEAD)
1920

2021
if [ -z "${BUILDER}" -o "${BUILDER}" = 'docker' ] ; then
2122
docker build --pull -t ${IMG}:${TAG} -f ${DOCKERFILE} .
22-
docker tag ${IMG}:${TAG} ${IMG}:devel
23+
docker tag ${IMG}:${TAG} ${IMG}:${SRCREV}
2324
elif [ "${BUILDER}" = 'buildah' ] ; then
2425
buildah bud --pull-always -t ${IMG}:${TAG} -f ${DOCKERFILE} .
25-
buildah tag ${IMG}:${TAG} ${IMG}:devel
26+
buildah tag ${IMG}:${TAG} ${IMG}:${SRCREV}
2627
else
2728
(>&2 echo "Unknown builder ${BUILDER}")
2829
exit 1

build/docker/intel-qat-plugin.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ RUN chmod a+x /go/bin/qat_plugin \
4545
FROM scratch as final
4646
COPY --from=builder /install_root /
4747
ENV PATH=/usr/local/bin
48-
CMD ["/usr/local/bin/intel_qat_device_plugin"]
48+
ENTRYPOINT ["/usr/local/bin/intel_qat_device_plugin"]

demo/build-image.sh

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,28 @@
22

33
IMG=$1
44
BUILDER=$2
5+
DIR=$(basename $IMG)
56

6-
if [ -z "$IMG" ]; then
7+
if [ -z "$DIR" ]; then
78
(>&2 echo "Usage: $0 <image directory>")
89
exit 1
910
fi
1011

11-
if [ ! -d "$IMG" ]; then
12-
(>&2 echo "Directory $IMG doesn't exist")
12+
if [ ! -d "$DIR" ]; then
13+
(>&2 echo "Directory $DIR doesn't exist")
1314
exit 1
1415
fi
1516

1617
CWD=`dirname $0`
17-
TAG=`git rev-parse HEAD`
18+
TAG=${TAG:-devel}
19+
SRCREV=$(git rev-parse HEAD)
1820

1921
if [ -z "$BUILDER" -o "$BUILDER" = 'docker' ] ; then
20-
docker build --rm -t ${IMG}:${TAG} "$CWD/$IMG/"
21-
docker tag ${IMG}:${TAG} ${IMG}:devel
22+
docker build --pull -t ${IMG}:${TAG} "$CWD/$DIR/"
23+
docker tag ${IMG}:${TAG} ${IMG}:${SRCREV}
2224
elif [ "$BUILDER" = 'buildah' ] ; then
23-
buildah bud -t ${IMG}:${TAG} "$CWD/$IMG/"
24-
buildah tag ${IMG}:${TAG} ${IMG}:devel
25+
buildah bud --pull-always -t ${IMG}:${TAG} "$CWD/$DIR/"
26+
buildah tag ${IMG}:${TAG} ${IMG}:${SRCREV}
2527
else
2628
(>&2 echo "Unknown builder $BUILDER")
2729
exit 1

deployments/fpga_admissionwebhook/deployment-tpl.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ spec:
1313
spec:
1414
containers:
1515
- name: fpga-mutator
16-
image: intel-fpga-admissionwebhook:devel
16+
image: intel/intel-fpga-admissionwebhook:devel
1717
imagePullPolicy: IfNotPresent
1818
args:
1919
- -tls-cert-file=/etc/webhook/certs/cert.pem

deployments/fpga_plugin/fpga_plugin.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
serviceAccountName: intel-fpga-plugin-controller
1818
initContainers:
1919
- name: intel-fpga-initcontainer
20-
image: intel-fpga-initcontainer:devel
20+
image: intel/intel-fpga-initcontainer:devel
2121
imagePullPolicy: IfNotPresent
2222
volumeMounts:
2323
- mountPath: /opt/intel/fpga-sw
@@ -31,7 +31,7 @@ spec:
3131
valueFrom:
3232
fieldRef:
3333
fieldPath: spec.nodeName
34-
image: intel-fpga-plugin:devel
34+
image: intel/intel-fpga-plugin:devel
3535
imagePullPolicy: IfNotPresent
3636
volumeMounts:
3737
- name: devfs

deployments/gpu_plugin/gpu_plugin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ spec:
2121
valueFrom:
2222
fieldRef:
2323
fieldPath: spec.nodeName
24-
image: intel-gpu-plugin:devel
24+
image: intel/intel-gpu-plugin:devel
2525
imagePullPolicy: IfNotPresent
2626
volumeMounts:
2727
- name: devfs

deployments/qat_dpdk_app/base/crypto-perf-dpdk-pod-requesting-qat.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
spec:
66
containers:
77
- name: crypto-perf
8-
image: crypto-perf:devel
8+
image: intel/crypto-perf:devel
99
imagePullPolicy: IfNotPresent
1010
command: [ "/bin/bash", "-c", "--" ]
1111
args: [ "while true; do sleep 300000; done;" ]

deployments/qat_plugin/qat_plugin.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
spec:
1616
containers:
1717
- name: intel-qat-plugin
18-
image: intel-qat-plugin:devel
18+
image: intel/intel-qat-plugin:devel
1919
env:
2020
- name: DPDK_DRIVER
2121
valueFrom:
@@ -38,7 +38,7 @@ spec:
3838
name: intel-qat-plugin-config
3939
key: DEBUG
4040
imagePullPolicy: IfNotPresent
41-
command: ["/usr/bin/intel_qat_device_plugin", "-dpdk-driver", "$(DPDK_DRIVER)", "-kernel-vf-drivers", "$(KERNEL_VF_DRIVERS)", "-max-num-devices", "$(MAX_NUM_DEVICES)", "-debug", "$(DEBUG)"]
41+
args: ["-dpdk-driver", "$(DPDK_DRIVER)", "-kernel-vf-drivers", "$(KERNEL_VF_DRIVERS)", "-max-num-devices", "$(MAX_NUM_DEVICES)", "-debug", "$(DEBUG)"]
4242
volumeMounts:
4343
- name: pcidir
4444
mountPath: /sys/bus/pci

0 commit comments

Comments
 (0)