From c742675711130570031bc42c8de62966de9839ea Mon Sep 17 00:00:00 2001 From: Yang Chiu Date: Tue, 5 Mar 2024 09:26:41 +0800 Subject: [PATCH] ci: build and publish e2e test image for negative testing with drone Signed-off-by: Yang Chiu --- .drone.yml | 140 ++++++++++++++++++++++++++++++++++++++++++++++--- e2e/Dockerfile | 2 +- 2 files changed, 135 insertions(+), 7 deletions(-) diff --git a/.drone.yml b/.drone.yml index a62882f41e..8275ce7c49 100644 --- a/.drone.yml +++ b/.drone.yml @@ -27,7 +27,7 @@ steps: - name: socket path: /var/run/docker.sock -- name: "build image" +- name: "build longhorn-manager-test image" image: plugins/docker settings: dry_run: true @@ -56,7 +56,7 @@ steps: event: - push -- name: publish-tagged-image +- name: "publish tagged longhorn-manager-test image" image: plugins/docker settings: build_args: @@ -73,6 +73,52 @@ steps: event: - tag +- name: "build longhorn-e2e-test image" + image: plugins/docker + settings: + dry_run: true + build_args: + - ARCH=amd64 + dockerfile: e2e/Dockerfile + repo: longhornio/longhorn-e2e-test + when: + event: + - pull_request + +- name: "publish longhorn-e2e-test image" + image: plugins/docker + settings: + build_args: + - ARCH=amd64 + custom_dns: 1.1.1.1 + dockerfile: e2e/Dockerfile + password: + from_secret: docker_password + repo: longhornio/longhorn-e2e-test + tag: "${DRONE_BRANCH}-head-amd64" + username: + from_secret: docker_username + when: + event: + - push + +- name: "publish tagged longhorn-e2e-test image" + image: plugins/docker + settings: + build_args: + - ARCH=amd64 + custom_dns: 1.1.1.1 + dockerfile: e2e/Dockerfile + password: + from_secret: docker_password + repo: longhornio/longhorn-e2e-test + tag: "${DRONE_TAG}-amd64" + username: + from_secret: docker_username + when: + event: + - tag + volumes: - name: socket host: @@ -107,7 +153,7 @@ steps: - name: socket path: /var/run/docker.sock -- name: "build image" +- name: "build longhorn-manager-test image" image: plugins/docker settings: dry_run: true @@ -136,7 +182,7 @@ steps: event: - push -- name: publish-tagged-image +- name: "publish tagged longhorn-manager-test image" image: plugins/docker settings: build_args: @@ -153,6 +199,52 @@ steps: event: - tag +- name: "build longhorn-e2e-test image" + image: plugins/docker + settings: + dry_run: true + build_args: + - ARCH=arm64 + dockerfile: e2e/Dockerfile + repo: longhornio/longhorn-e2e-test + when: + event: + - pull_request + +- name: "publish longhorn-e2e-test image" + image: plugins/docker + settings: + build_args: + - ARCH=arm64 + custom_dns: 1.1.1.1 + dockerfile: e2e/Dockerfile + password: + from_secret: docker_password + repo: longhornio/longhorn-e2e-test + tag: "${DRONE_BRANCH}-head-arm64" + username: + from_secret: docker_username + when: + event: + - push + +- name: "publish tagged longhorn-e2e-test image" + image: plugins/docker + settings: + build_args: + - ARCH=arm64 + custom_dns: 1.1.1.1 + dockerfile: e2e/Dockerfile + password: + from_secret: docker_password + repo: longhornio/longhorn-e2e-test + tag: "${DRONE_TAG}-arm64" + username: + from_secret: docker_username + when: + event: + - tag + volumes: - name: socket host: @@ -172,7 +264,7 @@ trigger: - v* steps: -- name: manifest +- name: "publish longhorn-manager-test manifest" image: plugins/manifest:1 settings: username: @@ -190,7 +282,7 @@ steps: event: - push -- name: manifest-tag +- name: "publish tagged longhorn-manager-test manifest" image: plugins/manifest:1 settings: username: @@ -208,6 +300,42 @@ steps: event: - tag +- name: "publish longhorn-e2e-test manifest" + image: plugins/manifest:1 + settings: + username: + from_secret: docker_username + password: + from_secret: docker_password + platforms: + - linux/amd64 + - linux/arm64 + target: "longhornio/longhorn-e2e-test:${DRONE_BRANCH}-head" + template: "longhornio/longhorn-e2e-test:${DRONE_BRANCH}-head-ARCH" + when: + instance: + - drone-publish.longhorn.io + event: + - push + +- name: "publish tagged longhorn-e2e-test manifest" + image: plugins/manifest:1 + settings: + username: + from_secret: docker_username + password: + from_secret: docker_password + platforms: + - linux/amd64 + - linux/arm64 + target: "longhornio/longhorn-e2e-test:${DRONE_TAG}" + template: "longhornio/longhorn-e2e-test:${DRONE_TAG}-ARCH" + when: + instance: + - drone-publish.longhorn.io + event: + - tag + depends_on: - default-amd64 - default-arm64 diff --git a/e2e/Dockerfile b/e2e/Dockerfile index 8a28d9e1a9..02ebde0ed4 100644 --- a/e2e/Dockerfile +++ b/e2e/Dockerfile @@ -5,7 +5,7 @@ ARG YQ_VERSION=v4.24.2 ARG ARCH=amd64 RUN zypper ref -f -RUN zypper in -y vim-small nfs-client xfsprogs e2fsprogs util-linux-systemd gcc python39-devel gawk java-11-openjdk tar awk gzip wget && \ +RUN zypper in -y vim-small nfs-client xfsprogs e2fsprogs util-linux-systemd gcc python311-devel gawk java-11-openjdk tar awk gzip wget && \ rm -rf /var/cache/zypp/* RUN curl -sO https://storage.googleapis.com/kubernetes-release/release/$KUBECTL_VERSION/bin/linux/${ARCH}/kubectl && \