From ff3d3e0d110e8a3bbcbce5715d11051a1af62ad2 Mon Sep 17 00:00:00 2001 From: Yang Chiu Date: Tue, 22 Nov 2022 13:57:45 +0800 Subject: [PATCH] ci: add arm64 and s390x support Signed-off-by: Yang Chiu --- .drone.yml | 186 +++++++++++++++++++++++++++++++++++++++++++++- Dockerfile.dapper | 20 +---- scripts/validate | 2 +- 3 files changed, 186 insertions(+), 22 deletions(-) diff --git a/.drone.yml b/.drone.yml index d9a141d1..dad47cfb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,7 +8,7 @@ platform: steps: - name: build - image: rancher/dapper:v0.4.1 + image: rancher/dapper:v0.5.8 commands: - dapper ci volumes: @@ -25,7 +25,7 @@ steps: password: from_secret: docker_password repo: "rancher/support-bundle-kit" - tag: ${DRONE_BRANCH}-head + tag: "${DRONE_BRANCH}-head-amd64" username: from_secret: docker_username when: @@ -43,14 +43,13 @@ steps: password: from_secret: docker_password repo: "rancher/support-bundle-kit" - tag: "${DRONE_TAG}" + tag: "${DRONE_TAG}-amd64" username: from_secret: docker_username when: instance: - drone-publish.rancher.io ref: - - refs/head/master - refs/tags/* event: - tag @@ -59,3 +58,182 @@ volumes: - name: docker host: path: /var/run/docker.sock +--- +kind: pipeline +name: arm64 + +platform: + os: linux + arch: arm64 + +steps: + - name: build + image: rancher/dapper:v0.5.8 + commands: + - dapper ci + volumes: + - name: docker + path: /var/run/docker.sock + + - name: docker-publish-master + image: plugins/docker + settings: + build_args: + - ARCH=arm64 + - VERSION=${DRONE_BRANCH}-${DRONE_COMMIT_SHA:0:8}-head + dockerfile: package/Dockerfile + password: + from_secret: docker_password + repo: "rancher/support-bundle-kit" + tag: "${DRONE_BRANCH}-head-arm64" + username: + from_secret: docker_username + when: + ref: + include: + - "refs/heads/master" + - "refs/heads/release/v*" + event: + - push + + - name: docker-publish + image: plugins/docker + settings: + dockerfile: package/Dockerfile + password: + from_secret: docker_password + repo: "rancher/support-bundle-kit" + tag: "${DRONE_TAG}-arm64" + username: + from_secret: docker_username + when: + instance: + - drone-publish.rancher.io + ref: + - refs/tags/* + event: + - tag + +volumes: + - name: docker + host: + path: /var/run/docker.sock +--- +kind: pipeline +name: s390x + +platform: + os: linux + arch: amd64 + +# Hack needed for s390x: https://gist.github.com/colstrom/c2f359f72658aaabb44150ac20b16d7c#gistcomment-3858388 +node: + arch: s390x + +steps: + - name: build + image: rancher/dapper:v0.5.8 + commands: + - dapper ci + volumes: + - name: docker + path: /var/run/docker.sock + + - name: docker-publish-master + image: rancher/drone-images:docker-s390x + settings: + build_args: + - ARCH=s390x + - VERSION=${DRONE_BRANCH}-${DRONE_COMMIT_SHA:0:8}-head + dockerfile: package/Dockerfile + password: + from_secret: docker_password + repo: "rancher/support-bundle-kit" + tag: "${DRONE_BRANCH}-head-s390x" + username: + from_secret: docker_username + when: + ref: + include: + - "refs/heads/master" + - "refs/heads/release/v*" + event: + - push + + - name: docker-publish + image: rancher/drone-images:docker-s390x + settings: + dockerfile: package/Dockerfile + password: + from_secret: docker_password + repo: "rancher/support-bundle-kit" + tag: "${DRONE_TAG}-s390x" + username: + from_secret: docker_username + when: + instance: + - drone-publish.rancher.io + ref: + - refs/tags/* + event: + - tag + +volumes: + - name: docker + host: + path: /var/run/docker.sock +--- +kind: pipeline +name: manifest + +platform: + os: linux + arch: amd64 + +steps: +- name: manifest-master + image: plugins/manifest:1 + settings: + username: + from_secret: docker_username + password: + from_secret: docker_password + platforms: + - linux/amd64 + - linux/arm64 + - linux/s390x + target: "rancher/support-bundle-kit:${DRONE_BRANCH}-head" + template: "rancher/support-bundle-kit:${DRONE_BRANCH}-head-ARCH" + when: + ref: + include: + - "refs/heads/master" + - "refs/heads/release/v*" + event: + - push + +- name: manifest-tag + image: plugins/manifest:1 + settings: + username: + from_secret: docker_username + password: + from_secret: docker_password + platforms: + - linux/amd64 + - linux/arm64 + - linux/s390x + target: "rancher/support-bundle-kit:${DRONE_TAG}" + template: "rancher/support-bundle-kit:${DRONE_TAG}-ARCH" + when: + instance: + - drone-publish.rancher.io + ref: + - refs/tags/* + event: + - tag + +depends_on: +- amd64 +- arm64 +- s390x diff --git a/Dockerfile.dapper b/Dockerfile.dapper index ca022cee..9cdcc64f 100644 --- a/Dockerfile.dapper +++ b/Dockerfile.dapper @@ -1,28 +1,14 @@ -FROM golang:1.18 +FROM registry.suse.com/bci/golang:1.18 ARG DAPPER_HOST_ARCH ENV ARCH $DAPPER_HOST_ARCH # -- for make rules ## install docker client -RUN apt-get update -qq && apt-get install -y --no-install-recommends \ - apt-transport-https \ - ca-certificates \ - curl \ - gnupg \ - lsb-release \ - rsync \ - && rm -rf /var/lib/apt/lists/* \ - && curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg \ - && echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \ - && apt-get update -qq && apt-get install -y --no-install-recommends \ - docker-ce docker-ce-cli containerd.io \ - && rm -rf /var/lib/apt/lists/* +RUN zypper -n install ca-certificates awk lsb-release rsync docker containerd ## install golangci -RUN if [ "${ARCH}" = "amd64" ]; then \ - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(go env GOPATH)/bin" v1.50.1; \ - fi +RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(go env GOPATH)/bin" v1.50.1; ## install k8s.io and generate openapi spec RUN mkdir -p /go/src/github.com/kubernetes && \ diff --git a/scripts/validate b/scripts/validate index 3bb39ddb..4687944a 100755 --- a/scripts/validate +++ b/scripts/validate @@ -15,4 +15,4 @@ if [[ -z "$(command -v golangci-lint)" ]]; then fi echo "Running: golangci-lint run" -golangci-lint run --timeout 5m +golangci-lint run --timeout 10m