You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
238 lines
7.3 KiB
YAML
238 lines
7.3 KiB
YAML
---
|
|
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: <https://git.webhosting.rug.nl/{{ build.author }}|{{ build.author }}>
|
|
<{{ build.link }}|Visit build page ↗>
|
|
|
|
---
|
|
kind: pipeline
|
|
name: build-docker-image
|
|
type: kubernetes
|
|
|
|
steps:
|
|
- name: scheduler-and-api
|
|
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
|
|
build_args:
|
|
- DOCKER_CACHE=registry.webhosting.rug.nl/cache/library/
|
|
- DEBUG=False
|
|
tags:
|
|
- ${DRONE_SOURCE_BRANCH/\//-}
|
|
- ${DRONE_SOURCE_BRANCH/\//-}-${DRONE_COMMIT_SHA:0:8}
|
|
when:
|
|
event:
|
|
exclude:
|
|
- tag
|
|
|
|
---
|
|
kind: pipeline
|
|
name: build-nginx-image
|
|
type: kubernetes
|
|
|
|
steps:
|
|
- name: nginx-frontend-proxy
|
|
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,,}-ngx
|
|
registry: registry.webhosting.rug.nl
|
|
dockerfile: docker/Dockerfile.nginx
|
|
# 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
|
|
build_args:
|
|
- DOCKER_CACHE=registry.webhosting.rug.nl/cache/library/
|
|
tags:
|
|
- ${DRONE_SOURCE_BRANCH/\//-}
|
|
- ${DRONE_SOURCE_BRANCH/\//-}-${DRONE_COMMIT_SHA:0:8}
|
|
when:
|
|
event:
|
|
exclude:
|
|
- tag
|
|
|
|
---
|
|
kind: pipeline
|
|
name: django-tests
|
|
type: kubernetes
|
|
|
|
trigger:
|
|
event:
|
|
exclude:
|
|
- tag
|
|
|
|
steps:
|
|
- name: tests
|
|
image: registry.webhosting.rug.nl/${DRONE_REPO,,}:${DRONE_SOURCE_BRANCH/\//-}-${DRONE_COMMIT_SHA:0:8}
|
|
environment:
|
|
# And a 'dummy' secret key for testing
|
|
SECRET_KEY: w@b=#(f4uc0l%e!5*eo+aoflnxb(@!l9!=c5w=4b+x$=!8&vy%a
|
|
OIDC_RP_CLIENT_ID: dummy
|
|
OIDC_RP_CLIENT_SECRET: dummy
|
|
OIDC_OP_AUTHORIZATION_ENDPOINT: dummy
|
|
OIDC_OP_TOKEN_ENDPOINT: dummy
|
|
OIDC_OP_USER_ENDPOINT: dummy
|
|
OIDC_OP_JWKS_ENDPOINT: dummy
|
|
commands:
|
|
- cd VRE
|
|
- python manage.py test apps
|
|
|
|
depends_on:
|
|
- build-docker-image
|
|
|
|
---
|
|
kind: pipeline
|
|
name: rancher-deployment
|
|
type: kubernetes
|
|
|
|
clone:
|
|
disable: true
|
|
|
|
steps:
|
|
- name: API
|
|
image: registry.webhosting.rug.nl/cache/ystyle/drone-plugin-rancher2
|
|
commands: # This is a custom hack to get a readable build date in the environment variables
|
|
- PLUGIN_DATA=$${PLUGIN_DATA\/\[BUILD_DATE\]\/$$(date +'UTC_%Y-%m-%dT%H-%M-%S')} /bin/drone-plugin
|
|
settings:
|
|
api: https://k8s.rug.nl/v3/project/c-gxr59:p-hwc8c/workloads/deployment:vre:broker-api
|
|
access_key:
|
|
from_secret: RANCHER_USER
|
|
secret_key:
|
|
from_secret: RANCHER_PASSWORD
|
|
data:
|
|
[
|
|
{
|
|
"name": "broker-api",
|
|
"image": "registry.webhosting.rug.nl/${DRONE_REPO,,}:${DRONE_SOURCE_BRANCH/\\//-}",
|
|
"environment":
|
|
{
|
|
"BUILD_TAG": "${DRONE_COMMIT_SHA:0:8}",
|
|
"BUILD_DATE": "[BUILD_DATE]",
|
|
},
|
|
},
|
|
]
|
|
|
|
- name: Scheduler
|
|
image: registry.webhosting.rug.nl/cache/ystyle/drone-plugin-rancher2
|
|
commands:
|
|
- PLUGIN_DATA=$${PLUGIN_DATA\/\[BUILD_DATE\]\/$$(date +'UTC_%Y-%m-%dT%H-%M-%S')} /bin/drone-plugin
|
|
settings:
|
|
api: https://k8s.rug.nl/v3/project/c-gxr59:p-hwc8c/workloads/deployment:vre:broker-scheduler
|
|
access_key:
|
|
from_secret: RANCHER_USER
|
|
secret_key:
|
|
from_secret: RANCHER_PASSWORD
|
|
data:
|
|
[
|
|
{
|
|
"name": "broker-scheduler",
|
|
"image": "registry.webhosting.rug.nl/${DRONE_REPO,,}:${DRONE_SOURCE_BRANCH/\\//-}",
|
|
"environment":
|
|
{
|
|
"BUILD_TAG": "${DRONE_COMMIT_SHA:0:8}",
|
|
"BUILD_DATE": "[BUILD_DATE]",
|
|
},
|
|
},
|
|
]
|
|
|
|
- name: NGINX
|
|
image: registry.webhosting.rug.nl/cache/ystyle/drone-plugin-rancher2
|
|
commands:
|
|
- PLUGIN_DATA=$${PLUGIN_DATA\/\[BUILD_DATE\]\/$$(date +'UTC_%Y-%m-%dT%H-%M-%S')} /bin/drone-plugin
|
|
settings:
|
|
api: https://k8s.rug.nl/v3/project/c-gxr59:p-hwc8c/workloads/deployment:vre:broker-api-nginx
|
|
access_key:
|
|
from_secret: RANCHER_USER
|
|
secret_key:
|
|
from_secret: RANCHER_PASSWORD
|
|
data:
|
|
[
|
|
{
|
|
"name": "broker-api-nginx",
|
|
"image": "registry.webhosting.rug.nl/${DRONE_REPO,,}-ngx:${DRONE_SOURCE_BRANCH/\\//-}",
|
|
"environment":
|
|
{
|
|
"BUILD_TAG": "${DRONE_COMMIT_SHA:0:8}",
|
|
"BUILD_DATE": "[BUILD_DATE]",
|
|
},
|
|
},
|
|
]
|
|
|
|
depends_on:
|
|
- django-tests
|
|
- build-docker-image
|
|
- build-nginx-image
|
|
|
|
---
|
|
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: <https://git.webhosting.rug.nl/{{ build.author }}|{{ build.author }}>
|
|
Duration: {{ since build.created }}
|
|
<{{ build.link }}|Visit build page ↗>
|
|
|
|
depends_on:
|
|
- build-docker-image
|
|
- build-nginx-image
|
|
- django-tests
|
|
- rancher-deployment
|
|
|
|
trigger:
|
|
status:
|
|
- success
|
|
- failure
|