Update base images in Harbor #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update base images in Harbor | |
on: | |
schedule: | |
- cron: '0 5 * * 0' # Weekly on Sundays at 05:00 | |
push: | |
branches: | |
- main | |
paths: | |
- 'teleservices/Dockerfile-base' | |
workflow_dispatch: | |
env: | |
IMAGE_NAME: teleservices/teleservices-bookworm-base | |
DEBIAN_VERSION: bookworm | |
jobs: | |
base_harbor: | |
runs-on: | |
group: self-hosted | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Install curl | |
run: sudo apt-get update && sudo apt-get install -y curl | |
- name: Login to Harbor | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ secrets.HARBOR_URL }} | |
username: ${{ secrets.TELESERVICES_HARBOR_USERNAME }} | |
password: ${{ secrets.TELESERVICES_HARBOR_PASSWORD }} | |
- name: Build | |
timeout-minutes: 15 | |
uses: docker/[email protected] | |
with: | |
context: teleservices | |
file: teleservices/Dockerfile-base | |
tags: | | |
${{ secrets.HARBOR_URL }}/${{ env.IMAGE_NAME }}:latest | |
${{ secrets.HARBOR_URL }}/${{ env.IMAGE_NAME }}:latest-${{ github.run_number }} | |
platforms: linux/amd64 | |
pull: true | |
push: true | |
build-args: | | |
DEBIAN_VERSION=${{ env.DEBIAN_VERSION }} | |
- name : Send notification on Mattermost | |
run: | | |
JOB_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" | |
MESSAGE="docker image $IMAGE_NAME has been updated on registry. [Click here to see job on GitHub]($JOB_URL) " | |
curl -i -X POST -H 'Content-Type: application/json' -d "{\"text\": \"$MESSAGE\"}" ${{ secrets.TELESERVICES_MATTERMOST_WEBHOOK_URL }} | |
- name : Send failure notification on Mattermost | |
if: failure() | |
run: | | |
JOB_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" | |
MESSAGE="Error : docker image $IMAGE_NAME has not been updated on registry. [Click here to see job on GitHub]($JOB_URL)" | |
curl -i -X POST -H 'Content-Type: application/json' -d "{\"text\": \"$MESSAGE\"}" ${{ secrets.TELESERVICES_MATTERMOST_WEBHOOK_URL }} |