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: workspace:
base: /git base: /git
path: pipeline path: pipeline
@ -10,20 +22,20 @@ pipeline:
check-tag: check-tag:
image: debian:11-slim image: debian:11-slim
pull: false pull: true
commands: commands:
- /bin/bash check-tag.sh - /bin/bash check-tag.sh
clone-source: clone-source:
image: docker:git image: docker:git
environment: environment:
- REGISTRY=code.balsillie.net *vars
- SOURCE_ORGANIZATION=mirrors
- REPO=matrix-service-synapse
commands: commands:
- git clone https://$REGISTRY/$SOURCE_ORGANIZATION/$REPO.git /git/$REPO - git clone "https://$${REGISTRY}/$${SOURCE_ORGANIZATION}/$${REPO}.git" /git/$${REPO}
- cd /git/$REPO - cd /git/$${REPO}
- git checkout $TAG - pwd
- git checkout ${TAG}
- ls
docker-build: docker-build:
image: docker:latest image: docker:latest
@ -43,9 +55,11 @@ pipeline:
commands: commands:
- export DOCKER_BUILDKIT=1 - export DOCKER_BUILDKIT=1
- cd /git/$${REPO} - cd /git/$${REPO}
- pwd
- ls
- echo $REGISTRY_PASSWORD | docker login $REGISTRY -u $REGISTRY_USER --password-stdin - echo $REGISTRY_PASSWORD | docker login $REGISTRY -u $REGISTRY_USER --password-stdin
- docker build - docker build
-t $REGISTRY/$ORGANIZATION/$REPO:$TAG -t $REGISTRY/$ORGANIZATION/$REPO:${TAG}
-t $REGISTRY/$ORGANIZATION/$REPO:$(date +%F) -t $REGISTRY/$ORGANIZATION/$REPO:$(date +%F)
-t $REGISTRY/$ORGANIZATION/$REPO:latest -t $REGISTRY/$ORGANIZATION/$REPO:latest
--pull --pull
@ -53,3 +67,14 @@ pipeline:
-f $${DOCKERFILE} -f $${DOCKERFILE}
$${CONTEXT} $${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)