-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (69 loc) · 2.61 KB
/
docker-publish.yml
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Docker
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
workflow_dispatch:
schedule:
# Build the job every day for the master branch
- cron: '0 0 * * *'
push:
branches: [ "main", 'v*.*.*' ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main", 'v*.*.*' ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
strategy:
fail-fast: false
matrix:
version: ["master"]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: quay.io
# github.repository as <account>/<repo>
IMAGE_NAME: powercloud/kind-node
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Set variables
run: |
KIND_VERSION=$(cat KIND_VERSION)
BASE_IMAGE=$(cat BASE_IMAGE)
echo "KIND_VERSION=$KIND_VERSION" >> $GITHUB_ENV
echo "BASE_IMAGE=$BASE_IMAGE" >> $GITHUB_ENV
export PATH=$PATH:$(go env GOPATH)/bin
echo "PATH=$PATH" >> $GITHUB_ENV
- name: Build and install kind - ${{ env.KIND_VERSION }}
run: |
# The runner has kind pre-installed, removing the same to install the preferred version.
rm -rf $(which kind)
git clone --depth 1 --branch ${{ env.KIND_VERSION }} https://github.com/kubernetes-sigs/kind.git
pushd kind
git apply ../build-ppc64le.patch
popd
make -C kind install
- name: Build kind-node image - ${{ matrix.version }}
run: |
mkdir -p tmp/kubernetes
git clone --single-branch --filter=tree:0 --branch ${{ matrix.version }} https://github.com/kubernetes/kubernetes tmp/kubernetes
kind build node-image $PWD/tmp/kubernetes --arch ppc64le --image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.version }} --base-image ${{ env.BASE_IMAGE }}
- name: Publish node image
if: github.event_name != 'pull_request'
run: |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.version }}