2021-09-05 16:39:46 +00:00
|
|
|
kind: pipeline
|
2021-12-16 18:59:15 +00:00
|
|
|
type: kubernetes
|
2021-12-26 02:17:26 +00:00
|
|
|
name: build-arm64
|
2021-12-16 17:58:03 +00:00
|
|
|
|
2021-12-16 18:03:49 +00:00
|
|
|
node_selector:
|
2021-12-26 02:17:26 +00:00
|
|
|
kubernetes.io/arch: arm64
|
2021-12-16 17:58:03 +00:00
|
|
|
|
2021-09-05 16:39:46 +00:00
|
|
|
steps:
|
2021-12-26 02:17:26 +00:00
|
|
|
- name: docker build
|
2021-09-05 16:39:46 +00:00
|
|
|
image: plugins/docker
|
|
|
|
settings:
|
2021-12-26 02:17:26 +00:00
|
|
|
repo: ${DRONE_REPO}
|
|
|
|
tag: ${DRONE_COMMIT_SHA:0:8}-arm64
|
2021-12-16 20:08:47 +00:00
|
|
|
# docker use a mtu of 1500 by default, which may cause packet drop in k8s
|
|
|
|
mtu: 1450
|
2021-09-05 16:39:46 +00:00
|
|
|
username:
|
|
|
|
from_secret: docker_username
|
|
|
|
password:
|
|
|
|
from_secret: docker_password
|
|
|
|
---
|
2021-08-28 22:09:55 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: kubernetes
|
2021-12-26 02:17:26 +00:00
|
|
|
name: build-amd64
|
2021-08-28 23:16:57 +00:00
|
|
|
|
2021-12-16 18:03:49 +00:00
|
|
|
node_selector:
|
2021-12-26 02:17:26 +00:00
|
|
|
kubernetes.io/arch: amd64
|
2021-08-28 22:09:55 +00:00
|
|
|
|
|
|
|
steps:
|
2021-12-26 02:17:26 +00:00
|
|
|
- name: docker build
|
2021-08-28 22:09:55 +00:00
|
|
|
image: plugins/docker
|
|
|
|
settings:
|
2021-12-26 02:17:26 +00:00
|
|
|
repo: ${DRONE_REPO}
|
|
|
|
tag: ${DRONE_COMMIT_SHA:0:8}-amd64
|
2021-12-16 20:08:47 +00:00
|
|
|
# docker use a mtu of 1500 by default, which may cause packet drop in k8s
|
|
|
|
mtu: 1450
|
2021-08-28 22:09:55 +00:00
|
|
|
username:
|
|
|
|
from_secret: docker_username
|
|
|
|
password:
|
2021-12-26 02:17:26 +00:00
|
|
|
from_secret: docker_password
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: kubernetes
|
2021-12-26 05:13:33 +00:00
|
|
|
name: create-multiarch-manifest
|
2021-12-26 02:17:26 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: docker manifest
|
|
|
|
image: docker:20-dind-rootless
|
|
|
|
commands:
|
|
|
|
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
|
|
|
|
- docker manifest create ${DRONE_REPO}:${DRONE_TAG:-latest} --amend ${DRONE_REPO}:${DRONE_COMMIT_SHA:0:8}-amd64 --amend ${DRONE_REPO}:${DRONE_COMMIT_SHA:0:8}-arm64
|
|
|
|
- docker manifest push ${DRONE_REPO}:${DRONE_TAG:-latest}
|
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME:
|
|
|
|
from_secret: docker_username
|
|
|
|
DOCKER_PASSWORD:
|
|
|
|
from_secret: docker_password
|
2021-12-26 04:53:48 +00:00
|
|
|
- name: cleanup
|
2021-12-26 05:13:33 +00:00
|
|
|
image: alpine
|
2021-12-26 04:53:48 +00:00
|
|
|
commands:
|
2021-12-26 05:13:33 +00:00
|
|
|
- apk add curl jq
|
|
|
|
- 'DOCKER_TOKEN="$(curl -sf -XPOST -H "Content-Type: application/json" -d "{\"username\":\"$DOCKER_USERNAME\",\"password\":\"$DOCKER_PASSWORD\"}" https://hub.docker.com/v2/users/login | jq --raw-output .token)"'
|
|
|
|
- 'curl -sf -XDELETE -H "Accept: application/json" -H "Authorization: Bearer $DOCKER_TOKEN" https://hub.docker.com/v2/repositories/${DRONE_REPO}/tags/${DRONE_COMMIT_SHA:0:8}-arm64/'
|
|
|
|
- 'curl -sf -XDELETE -H "Accept: application/json" -H "Authorization: Bearer $DOCKER_TOKEN" https://hub.docker.com/v2/repositories/${DRONE_REPO}/tags/${DRONE_COMMIT_SHA:0:8}-amd64/'
|
2021-12-26 04:53:48 +00:00
|
|
|
environment:
|
|
|
|
DOCKER_USERNAME:
|
|
|
|
from_secret: docker_username
|
|
|
|
DOCKER_PASSWORD:
|
|
|
|
from_secret: docker_password
|
2021-12-26 02:17:26 +00:00
|
|
|
|
|
|
|
depends_on:
|
|
|
|
- build-arm64
|
|
|
|
- build-amd64
|