add notification

This commit is contained in:
Michael Balsillie 2022-08-22 01:53:54 +12:00
parent d88041bfbf
commit 7881c91180
3 changed files with 37 additions and 9 deletions

View File

@ -1,3 +1,15 @@
variables:
&vars
- REGISTRY=code.balsillie.net
- REGISTRY_USER=michael
- ORGANIZATION=containers
- SOURCE_ORGANIZATION=mirrors
- REPO=matrix-service-synapse
- BUILD_ARGS=PYTHON_VERSION=3.10
- DOCKERFILE=docker/Dockerfile
- CONTEXT=.
- WATCHTOWER_HOST=watchtower.balsillie.net
workspace:
base: /git
path: pipeline
@ -10,20 +22,20 @@ pipeline:
check-tag:
image: debian:11-slim
pull: false
pull: true
commands:
- /bin/bash check-tag.sh
clone-source:
image: docker:git
environment:
- REGISTRY=code.balsillie.net
- SOURCE_ORGANIZATION=mirrors
- REPO=matrix-service-synapse
*vars
commands:
- git clone https://$REGISTRY/$SOURCE_ORGANIZATION/$REPO.git /git/$REPO
- cd /git/$REPO
- git checkout $TAG
- git clone "https://$${REGISTRY}/$${SOURCE_ORGANIZATION}/$${REPO}.git" /git/$${REPO}
- cd /git/$${REPO}
- pwd
- git checkout ${TAG}
- ls
docker-build:
image: docker:latest
@ -43,13 +55,26 @@ pipeline:
commands:
- export DOCKER_BUILDKIT=1
- cd /git/$${REPO}
- pwd
- ls
- echo $REGISTRY_PASSWORD | docker login $REGISTRY -u $REGISTRY_USER --password-stdin
- docker build
-t $REGISTRY/$ORGANIZATION/$REPO:$TAG
-t $REGISTRY/$ORGANIZATION/$REPO:${TAG}
-t $REGISTRY/$ORGANIZATION/$REPO:$(date +%F)
-t $REGISTRY/$ORGANIZATION/$REPO:latest
--pull
--build-arg $${BUILD_ARGS}
-f $${DOCKERFILE}
$${CONTEXT}
- docker push -a $REGISTRY/$ORGANIZATION/$REPO
- docker push -a $REGISTRY/$ORGANIZATION/$REPO
notify-watchtower:
image: debian:11-slim
pull: false
environment:
*vars
secrets:
- source: WATCHTOWER_HTTP_API_TOKEN
target: WATCHTOWER_HTTP_API_TOKEN
commands:
- /bin/bash notify-watchtower.sh

View File

@ -0,0 +1,2 @@
#!/bin/bash
curl -H "Authorization: Bearer ${WATCHTOWER_HTTP_API_TOKEN}" -i "https://${WATCHTOWER_HOST}/v1/update"

1
README.md Normal file
View File

@ -0,0 +1 @@
[![status-badge](https://pipeline.balsillie.net/api/badges/containers/matrix-service-synapse/status.svg)](https://pipeline.balsillie.net/containers/matrix-service-synapse)