-
Notifications
You must be signed in to change notification settings - Fork 32
31 lines (30 loc) · 1.17 KB
/
checkimage.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
name: Regular base image update check
on:
schedule:
- cron: "5 0 * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install skopeo
run: sudo apt-get install -y skopeo
- name: Check change
run: |
base=$(grep -Po '(?<=FROM )([^\s]*)(?= AS build)' Dockerfile)
skopeo inspect "docker://$base" | jq .Digest --raw-output > .baseimagedigest
docker run --rm -u 0 quay.io/cloudservices/compliance-backend:latest sh -c \
'microdnf update -y $(cat /opt/installedpackages) > /dev/null; rpm -q $(cat /opt/installedpackages) | sort | sha256sum | cut -d " " -f 1' \
>> .baseimagedigest
- name: Do change if the digest changed
run: |
git config user.name 'Update-a-Bot'
git config user.email '[email protected]'
git add .baseimagedigest
git commit -m "chore(image): update and rebuild image" || echo "No new changes"
- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
title: 'chore(image): update base image'