forked from keylime/keylime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a workflow to automatically create pull requests updating the Fedora image used to build the base image. Build the base image separately when the Dockerfile template is updated. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
- Loading branch information
Showing
9 changed files
with
143 additions
and
33 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Build containers base image | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- docker/release/base/Dockerfile.in | ||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: quay.io | ||
IMAGE_BASE: quay.io/keylime | ||
|
||
jobs: | ||
build-images: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ secrets.QUAY_USER }} | ||
password: ${{ secrets.QUAY_TOKEN }} | ||
|
||
- name: Generate docker metadata for keylime_base | ||
id: meta_base | ||
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 | ||
with: | ||
images: | | ||
${{ env.IMAGE_BASE }}/keylime_base | ||
tags: | | ||
type=ref,enable=true,priority=600,prefix=,suffix=,event=branch | ||
type=ref,enable=true,priority=600,prefix=,suffix=,event=tag | ||
type=sha,prefix=sha- | ||
type=schedule,pattern={{date 'YYYYMMDD'}} | ||
type=raw,monthly | ||
- name: Prepare Dockerfile | ||
run: | | ||
cd docker/release/base | ||
sed "s#_version_#${{ steps.meta_base.outputs.version }}#" "Dockerfile.in" > Dockerfile | ||
- name: Build and push base image | ||
id: build | ||
uses: docker/build-push-action@0a97817b6ade9f46837855d676c4cca3a2471fc9 | ||
with: | ||
context: . | ||
file: docker/release/base/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta_base.outputs.tags }} | ||
labels: ${{ steps.meta_base.outputs.labels }} | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Create PR updating containers base image | ||
|
||
on: | ||
workflow_dispatch: | ||
branches: | ||
- master | ||
schedule: | ||
- cron: "0 0 1 * *" | ||
|
||
env: | ||
FEDORA_IMAGE: quay.io/fedora/fedora | ||
TAG: latest | ||
IMAGE_BASE: quay.io/keylime | ||
|
||
jobs: | ||
update-base-image: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | ||
|
||
- name: Install skopeo and jq | ||
run: sudo apt-get install -y skopeo jq | ||
|
||
- name: Get hash of the latest stable version of Fedora | ||
run: echo "FEDORA_HASH=$(skopeo inspect docker://${{ env.FEDORA_IMAGE }}:${{ env.TAG }} | jq '.Digest')" >> "$GITHUB_ENV" | ||
|
||
- name: Update the Dockerfile template | ||
run: | | ||
cd docker/release/base | ||
sed -i "s#\(FROM \)[^ ]*#\1${{ env.FEDORA_IMAGE }}@${{ env.FEDORA_HASH }}#" Dockerfile.in | ||
- name: Get current date for message | ||
id: date | ||
run: echo "DATE=$(date +"%B %d")" >> "$GITHUB_ENV" | ||
|
||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c | ||
with: | ||
add-paths: docker/release/base/Dockerfile.in | ||
title: [Automatic] Update Keylime base image ${{ env.DATE }} | ||
body: | | ||
Automatic update the Keylime base image using: | ||
Base image: ${{ env.FEDORA_IMAGE }}@${{ env.FEDORA_HASH }} | ||
commit-message: | | ||
[Automatic] Update Keylime base image ${{ env.DATE }} | ||
Automatic update the Keylime base image using: | ||
Base image: ${{ env.FEDORA_IMAGE }}@${{ env.FEDORA_HASH }} | ||
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
FROM _source_keylime_base:_version_ AS keylime_registrar | ||
FROM _source_keylime_base_digest_ AS keylime_registrar | ||
LABEL version="_version_" description="Keylime Registrar - Bootstrapping and Maintaining Trust in the Cloud" | ||
MAINTAINER Keylime Team <main@keylime.groups.io> | ||
|
||
EXPOSE 8890 | ||
EXPOSE 8891 | ||
|
||
ENTRYPOINT ["keylime_registrar"] | ||
ENTRYPOINT ["keylime_registrar"] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
FROM _source_keylime_base:_version_ AS keylime_verifier | ||
FROM _source_keylime_base_digest_ AS keylime_verifier | ||
LABEL version="_version_" description="Keylime Verifier - Bootstrapping and Maintaining Trust in the Cloud" | ||
MAINTAINER Keylime Team <main@keylime.groups.io> | ||
|
||
EXPOSE 8880 | ||
EXPOSE 8881 | ||
|
||
ENTRYPOINT ["keylime_verifier"] | ||
ENTRYPOINT ["keylime_verifier"] |