diff --git a/.ci/setup_ci.sh b/.ci/setup_ci.sh index 31c635b6e92..d227a0774d5 100755 --- a/.ci/setup_ci.sh +++ b/.ci/setup_ci.sh @@ -1,23 +1,41 @@ #!/bin/bash -set -e +set -x + +if [ "$RESTY_IMAGE_TAG" != "xenial" ]; then + exit 0 +fi + +docker version +RESULT=$? +if [ "$RESULT" != "0" ]; then + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) test" + sudo apt-get update + sudo apt-get -y -o Dpkg::Options::="--force-confnew" install containerd.io docker-ce +fi -curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - -sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) test" -sudo apt-get update -sudo apt-get -y -o Dpkg::Options::="--force-confnew" install containerd.io docker-ce echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json -curl -fsSLo buildx https://github.com/docker/buildx/releases/download/v0.2.2/buildx-v0.2.2.linux-amd64 -mkdir -p ~/.docker/cli-plugins/ -chmod +x buildx -mv buildx ~/.docker/cli-plugins/docker-buildx -sudo service docker restart + +docker buildx version +RESULT=$? +if [ "$RESULT" != "0" ]; then + curl -fsSLo buildx https://github.com/docker/buildx/releases/download/v0.2.2/buildx-v0.2.2.linux-amd64 + mkdir -p ~/.docker/cli-plugins/ + chmod +x buildx + mv buildx ~/.docker/cli-plugins/docker-buildx + sudo service docker restart +fi + if ! [ -x "$(command -v docker-machine)" ]; then - curl -L https://github.com/docker/machine/releases/download/v0.16.0/docker-machine-$(uname -s)-$(uname -m) >docker-machine - sudo install docker-machine /usr/local/bin/docker-machine + curl -L https://github.com/docker/machine/releases/download/v0.16.0/docker-machine-$(uname -s)-$(uname -m) >docker-machine + sudo install docker-machine /usr/local/bin/docker-machine fi + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin || true echo "$REDHAT_PASSWORD" | docker login -u "$REDHAT_USERNAME" registry.access.redhat.com --password-stdin || true docker-machine version docker version docker buildx version + +export BUILDX=true diff --git a/Jenkinsfile b/Jenkinsfile index 302e9526860..b7e6e0c06bc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -177,7 +177,7 @@ pipeline { sh 'make setup-ci' sh 'git clone --single-branch --branch ${KONG_SOURCE} https://github.com/Kong/kong.git ${KONG_SOURCE_LOCATION}' sh 'export BUILDX=false RESTY_IMAGE_TAG=bionic && make package-kong && make test && make cleanup' - sh 'export CACHE=false UPDATE_CACHE=true RESTY_IMAGE_TAG=xenial DOCKER_MACHINE_ARM64_NAME="jenkins-kong-"`cat /proc/sys/kernel/random/uuid` && make setup-build && make package-kong && make test' + sh 'export CACHE=false UPDATE_CACHE=true RESTY_IMAGE_TAG=xenial DOCKER_MACHINE_ARM64_NAME="jenkins-kong-"`cat /proc/sys/kernel/random/uuid` && make package-kong && make test' } post { always { @@ -206,4 +206,4 @@ pipeline { } } } -} +} \ No newline at end of file diff --git a/Makefile b/Makefile index 5462740541b..9fcd57ea440 100644 --- a/Makefile +++ b/Makefile @@ -50,9 +50,6 @@ else ifeq ($(RESTY_IMAGE_TAG),xenial) endif BUILDX_INFO ?= $(shell docker buildx 2>&1 >/dev/null; echo $?) -ifneq ($(BUILDX_INFO),) - BUILDX=false -endif ifeq ($(BUILDX),false) DOCKER_COMMAND?=docker build --build-arg BUILDPLATFORM=x/amd64 @@ -102,14 +99,13 @@ debug: @echo ${BUILDX_INFO} @echo ${DEBUG} -setup-ci: - @echo "no longer used" +setup-ci: setup-build -setup-build: cleanup-build +setup-build: + .ci/setup_ci.sh ifeq ($(RESTY_IMAGE_BASE),src) @echo "nothing to be done" else ifeq ($(BUILDX),true) - .ci/setup_ci.sh docker buildx create --name multibuilder docker-machine create --driver amazonec2 \ --amazonec2-instance-type a1.medium \ @@ -202,7 +198,7 @@ else package-kong: actual-package-kong endif -actual-package-kong: cleanup +actual-package-kong: cleanup setup-build ifeq ($(DEBUG),1) exit 1 endif