Skip to content

Commit

Permalink
Add dispatch to drone to rke2-upgrade (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
galal-hussein authored Jul 21, 2020
1 parent c63fa97 commit 648c35a
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
39 changes: 39 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,42 @@ steps:

depends_on:
- amd64

---
kind: pipeline
name: dispatch

platform:
os: linux
arch: amd64

steps:
- name: dispatch
image: rancher/dapper:v0.5.0
volumes:
- name: docker
path: /var/run/docker.sock
environment:
PAT_USERNAME:
from_secret: pat_username
PAT_TOKEN:
from_secret: github_token
commands:
- dapper -f Dockerfile --target dapper make dispatch
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag

volumes:
- name: docker
host:
path: /var/run/docker.sock

depends_on:
- manifest

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ VOLUME /var/lib/rancher/k3s

# Dapper/Drone/CI environment
FROM build AS dapper
ENV DAPPER_ENV REPO TAG DRONE_TAG
ENV DAPPER_ENV REPO TAG DRONE_TAG PAT_USERNAME PAT_TOKEN
ENV DAPPER_OUTPUT ./dist ./bin ./build
ENV DAPPER_DOCKER_SOCKET true
ENV DAPPER_TARGET dapper
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,11 @@ image-manifest:
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create --amend ${REPO}/rke2-runtime:${VERSION} ${REPO}/rke2-runtime:${VERSION}-${GOARCH}
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push ${REPO}/rke2-runtime:${VERSION}

dispatch:
curl -XPOST -u "${PAT_USERNAME}:${PAT_TOKEN}" \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Content-Type: application/json" https://api.github.com/repos/rancher/rke2-upgrade/dispatches \
--data '{"event_type": "create_tag", "client_payload": {"tag":"'"${DRONE_TAG}"'"}}'

help: ## this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

0 comments on commit 648c35a

Please sign in to comment.