Skip to content

Support arm64/amd64 for k3s #17

Support arm64/amd64 for k3s

Support arm64/amd64 for k3s #17

Workflow file for this run

name: Cache images for tests in GHCR
on:
push:
paths:
- 'scripts/docker-compose.yaml'
- '.github/workflows/docker.yml'
env:
IMAGES: "rancher/k3s:v1.31.2-k3s1,registry:2"
jobs:
cache-images:
if: github.event.pull_request.user.login != 'dependabot[bot]' && github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Cache images
run: |
for image in ${IMAGES//,/ }; do
new_image="ghcr.io/gavinbunney/terraform-provider-kubectl/testacc-$(echo $image | sed 's/\//-/')"
echo "Caching $image as $new_image"
docker rmi $image
docker pull $image --platform linux/amd64
docker tag $image $new_image-amd64
docker push $new_image-amd64
docker rmi $image
docker pull $image --platform linux/arm64
docker tag $image $new_image-arm64
docker push $new_image-arm64
done