woodpecker-util/.woodpecker.yml

75 lines
2.0 KiB
YAML

variables:
&vars
- REGISTRY=code.balsillie.net
- REGISTRY_USER=michael
- SHOUTRRR_VERSION=SHOUTRRR_VERSION=v0.6.1
- DOCKERFILE=Dockerfile
- CONTEXT=.
- MATRIX_HOST=matrix.balsillie.net
- MATRIX_PORT=443
- MATRIX_ROOM=!HdSXmuHcBMaYExEfkh:balsillie.net
workspace:
base: /git
path: pipeline
clone:
git:
image: woodpeckerci/plugin-git
pipeline:
docker-build:
image: docker:latest
when:
- event: tag
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
*vars
secrets:
- source: REGISTRY_PASSWORD
target: REGISTRY_PASSWORD
commands:
- echo $REGISTRY_PASSWORD | docker login $REGISTRY -u $REGISTRY_USER --password-stdin
- docker build
-t $REGISTRY/${CI_REPO}:${CI_COMMIT_TAG}
-t $REGISTRY/${CI_REPO}:$(date +%F_%H-%M)
-t $REGISTRY/${CI_REPO}:latest
--pull
--build-arg $${SHOUTRRR_VERSION}
-f $${DOCKERFILE}
$${CONTEXT}
- docker push -a $REGISTRY/${CI_REPO}
notify-matrix-success:
image: code.balsillie.net/containers/woodpecker-util
pull: false
when:
- event: tag
status: [ success ]
environment:
*vars
secrets:
- source: MATRIX_ACCESS_TOKEN
target: MATRIX_ACCESS_TOKEN
commands:
- shoutrrr send
--url matrix://$${MATRIX_ACCESS_TOKEN}@$${MATRIX_HOST}:$${MATRIX_PORT}/?rooms=$${MATRIX_ROOM}
--message "New image build of ${CI_REPO}, ${CI_COMMIT_TAG}, has been completed and pushed."
notify-matrix-failure:
image: code.balsillie.net/containers/woodpecker-util
pull: false
when:
- event: tag
status: [ failure ]
environment:
*vars
secrets:
- source: MATRIX_ACCESS_TOKEN
target: MATRIX_ACCESS_TOKEN
commands:
- shoutrrr send
--url matrix://$${MATRIX_ACCESS_TOKEN}@$${MATRIX_HOST}:$${MATRIX_PORT}/?rooms=$${MATRIX_ROOM}
--message "New image build of ${CI_REPO}, ${CI_COMMIT_TAG}, has failed."