-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: build third party images with chainguard
- Loading branch information
Showing
3 changed files
with
135 additions
and
0 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,51 @@ | ||
name: 'Build and push a dep image with apko' | ||
description: 'Composite action for building and pushing a dep image with apko' | ||
inputs: | ||
apko-config: | ||
description: 'Path to apko config' | ||
required: true | ||
|
||
image-name: | ||
description: 'Full destination image name' | ||
required: true | ||
|
||
registry-username: | ||
description: 'Username to login to registry' | ||
default: '' | ||
required: false | ||
|
||
registry-password: | ||
description: 'Password to login to registry' | ||
default: '' | ||
required: false | ||
|
||
overwrite: | ||
description: 'Overwrite the existing image tag' | ||
default: 'false' | ||
required: false | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- id: check-image-exists | ||
if: ${{ inputs.overwrite != 'true' }} | ||
shell: bash | ||
run: | | ||
set -euo pipefail | ||
if docker manifest inspect ${{ inputs.image-name }} > /dev/null 2>&1; then | ||
echo "Image already exists. Will not overwrite." | ||
echo "image-exists=true" >> "$GITHUB_OUTPUT" | ||
else | ||
echo "Image does not exist. Will build and push." | ||
echo "image-exists=false" >> "$GITHUB_OUTPUT" | ||
fi | ||
- uses: chainguard-images/actions/apko-publish@main | ||
if: ${{ inputs.overwrite == 'true' || steps.check-image-exists.outputs.image-exists == 'false' }} | ||
with: | ||
config: ${{ inputs.apko-config }} | ||
archs: amd64,arm64 | ||
tag: ${{ inputs.image-name }} | ||
vcs-url: true | ||
generic-user: ${{ inputs.registry-username }} | ||
generic-pass: ${{ inputs.registry-password }} |
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,47 @@ | ||
name: Update image deps | ||
|
||
on: | ||
schedule: | ||
- cron: '0 4 * * *' | ||
workflow_dispatch: | ||
inputs: | ||
overwrite: | ||
description: 'Overwrite the existing image tags' | ||
required: false | ||
default: 'true' | ||
push: | ||
branches: | ||
- emosbaugh/sc-108755/use-chainguard-images-for-embedded-cluster | ||
jobs: | ||
build-3rd-party-images: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get tags | ||
id: get-tags | ||
run: | | ||
set -euo pipefail | ||
# We're only using the APKINDEX files to get the versions, so it doesn't matter which arch we use | ||
curl -LO --fail --show-error https://packages.wolfi.dev/os/x86_64/APKINDEX.tar.gz | ||
tar -xzvf APKINDEX.tar.gz | ||
calico_version=$(< APKINDEX grep -A1 "^P:calico$" | tail -n 1 | sed -n -e 's/V://p' | tr -d '\n') | ||
sed "s/__CALICO_VERSION__/$calico_version/g" deploy/images/calico-node/apko.tmpl.yaml > deploy/images/calico-node/apko.yaml | ||
{ | ||
echo "calico-tag=$calico_version" | ||
} >> "$GITHUB_OUTPUT" | ||
- name: Build and push calico-node image | ||
uses: ./.github/actions/build-dep-image-with-apko | ||
with: | ||
apko-config: deploy/images/calico-node/apko.yaml | ||
image-name: docker.io/replicated/ec-calico-node:${{ steps.get-tags.outputs.calico-tag }} | ||
registry-username: ${{ secrets.DOCKERHUB_USER }} | ||
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
overwrite: ${{ github.event.inputs.overwrite }} |
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,37 @@ | ||
contents: | ||
repositories: | ||
- https://packages.wolfi.dev/os | ||
keyring: | ||
- https://packages.wolfi.dev/os/wolfi-signing.rsa.pub | ||
packages: | ||
- calico-node=__CALICO_VERSION__ | ||
|
||
accounts: | ||
groups: | ||
- groupname: nonroot | ||
gid: 65532 | ||
users: | ||
- username: nonroot | ||
uid: 65532 | ||
gid: 65532 | ||
# calico-node is responsible for many host level networking tasks and as such, needs root | ||
run-as: "0" | ||
|
||
environment: | ||
# Tell sv where to find the services | ||
SVDIR: /etc/service/enabled | ||
|
||
paths: | ||
- path: /etc/service/available | ||
type: directory | ||
uid: 0 | ||
gid: 0 | ||
permissions: 0o755 | ||
- path: /etc/calico | ||
type: directory | ||
uid: 65532 | ||
gid: 65532 | ||
permissions: 0o755 | ||
|
||
entrypoint: | ||
command: /usr/sbin/start_runit |