You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

159 lines
4.4 KiB

---
kind: pipeline
name: notify-pipeline-start
type: kubernetes
clone:
disable: true
steps:
- name: slack
image: plugins/slack
settings:
webhook:
from_secret: SLACK_WEBHOOK
link_names: true
template: >
{{#if build.pull }}
*Build started*: {{ repo.owner }}/{{ repo.name }} - <https://git.webhosting.rug.nl/{{ repo.owner }}/{{ repo.name }}/pull/{{ build.pull }}|Pull Request #{{ build.pull }}>
{{else}}
*Build started: {{ repo.owner }}/{{ repo.name }} - Build #{{ build.number }}* (type: `{{ build.event }}`)
{{/if}}
Commit: <https://git.webhosting.rug.nl/{{ repo.owner }}/{{ repo.name }}/commit/{{ build.commit }}|{{ truncate build.commit 8 }}>
Branch: <https://git.webhosting.rug.nl/{{ repo.owner }}/{{ repo.name }}/commits/{{ build.branch }}|{{ build.branch }}>
Author: {{ build.author }}
<{{ build.link }}|Visit build page ↗>
---
kind: pipeline
name: build-docker-image
type: kubernetes
steps:
- name: build-docker-image-branch
image: plugins/docker
settings:
cache_from:
- ${DRONE_REPO,,}:${DRONE_SOURCE_BRANCH/\//-}
username:
from_secret: HARBOR_USER
password:
from_secret: HARBOR_PASSWORD
repo: registry.webhosting.rug.nl/${DRONE_REPO,,}
registry: registry.webhosting.rug.nl
dockerfile: docker/Dockerfile
# During building the images, we use an internal RUG caching server for getting the raw docker images
# Without this, we will hit a rate limit of Docker. This only works on the RUG Drones building setup
# And we need to setup the correct API_URL and API_HTTPS=true by default
build_args:
- DOCKER_CACHE=registry.webhosting.rug.nl/cache/library/
- API_URL=https://workspaces.research.rug.nl/
- API_HTTPS=true
tags:
- ${DRONE_SOURCE_BRANCH/\//-}
- ${DRONE_SOURCE_BRANCH/\//-}-${DRONE_COMMIT_SHA:0:8}
when:
event:
exclude:
- tag
---
kind: pipeline
name: notify-pipeline-end
type: kubernetes
clone:
disable: true
steps:
- name: slack
image: plugins/slack
settings:
webhook:
from_secret: SLACK_WEBHOOK
link_names: true
template: >
{{#if build.pull }}
*{{#success build.status}}✔{{ else }}✘{{/success}} {{ uppercasefirst build.status }}*: {{ repo.owner }}/{{ repo.name }} - <https://git.webhosting.rug.nl/{{ repo.owner }}/{{ repo.name }}/pull/{{ build.pull }}|Pull Request #{{ build.pull }}>
{{else}}
*{{#success build.status}}✔{{ else }}✘{{/success}} {{ uppercasefirst build.status }}: {{ repo.owner }}/{{ repo.name }} - Build #{{ build.number }}* (type: `{{ build.event }}`)
{{/if}}
Commit: <https://git.webhosting.rug.nl/{{ repo.owner }}/{{ repo.name }}/commit/{{ build.commit }}|{{ truncate build.commit 8 }}>
Branch: <https://git.webhosting.rug.nl/{{ repo.owner }}/{{ repo.name }}/commits/{{ build.branch }}|{{ build.branch }}>
Author: {{ build.author }}
Duration: {{ since build.created }}
<{{ build.link }}|Visit build page ↗>
depends_on:
- build-docker-image
trigger:
status:
- success
- failure
# ---
# # Run tests on every push of a "feature/*"" branch
# kind: pipeline
# type: kubernetes
# name: vue-tests
# steps:
# - name: test
# image: node:16
# commands:
# - yarn install
# - yarn lint
# - yarn test
# trigger:
# branch:
# - feature/*
# event:
# - push
# ---
# # Run tests and squash-merge into master when a "merge" tag is committed on a "feature/*" branch
# kind: pipeline
# type: kubernetes
# name: vue-tests-and-merge
# steps:
# - name: test-and-merge
# image: node:16
# commands:
# - git fetch master
# - yarn install
# - yarn lint
# - yarn test
# - NAME=$(git branch --show-current)
# - git checkout master
# - git merge --squash $NAME
# - git commit --amend -m "Drone merged '$NAME' into 'master'"
# trigger:
# branch:
# - feature/*
# event:
# - tag
# ref:
# - refs/tags/merge
# ---
# # Deploy when a commit of the master branch is tagged with a "deploy:<date>" tag
# kind: pipeline
# type: kubernetes
# name: vue-deploy
# steps:
# - name: deploy
# image: node:16
# commands:
# - yarn deploy
# trigger:
# branch:
# - master
# event:
# - tag
# ref:
# - refs/tags/deploy:*