diff --git a/.woodpecker/main.yml b/.woodpecker/main.yml index 8e69de1..f87f9c1 100644 --- a/.woodpecker/main.yml +++ b/.woodpecker/main.yml @@ -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 \ No newline at end of file + - 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 \ No newline at end of file diff --git a/.woodpecker/notify-watchtower.sh b/.woodpecker/notify-watchtower.sh new file mode 100644 index 0000000..8ca86ba --- /dev/null +++ b/.woodpecker/notify-watchtower.sh @@ -0,0 +1,2 @@ +#!/bin/bash +curl -H "Authorization: Bearer ${WATCHTOWER_HTTP_API_TOKEN}" -i "https://${WATCHTOWER_HOST}/v1/update" \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..fcfb833 --- /dev/null +++ b/README.md @@ -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) \ No newline at end of file