-
Notifications
You must be signed in to change notification settings - Fork 3
76 lines (68 loc) · 2 KB
/
module-ci.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
name: Transpire Module CI
on:
workflow_call:
inputs:
module_name:
required: true
type: string
secrets:
HARBOR_USERNAME:
required: true
HARBOR_PASSWORD:
required: true
OCF_CLUSTER_DEPLOY_KEY:
required: true
workflow_dispatch: {}
permissions:
packages: write
jobs:
build-matrix:
runs-on: ubuntu-latest
container: ghcr.io/ocf/transpire:latest
steps:
- uses: actions/checkout@v3
with:
repository: ocf/kubernetes
- id: set-matrix
run: transpire image build ${{ inputs.module_name }} -o gha
outputs:
image_matrix: ${{ steps.set-matrix.outputs.image_matrix }}
build-images:
needs: build-matrix
runs-on: ubuntu-latest
if: fromJson(needs.build-matrix.outputs.image_matrix)[0] != null
strategy:
matrix:
image: ${{ fromJson(needs.build-matrix.outputs.image_matrix) }}
steps:
- uses: docker/setup-buildx-action@v2
# --- TEMPORARY ---
# - name: Login to Harbor
# uses: docker/login-action@v2
# with:
# registry: harbor.ocf.berkeley.edu
# username: ${{ secrets.HARBOR_USERNAME }}
# password: ${{ secrets.HARBOR_PASSWORD }}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v4
with:
context: ${{ matrix.image.context }}
target: ${{ matrix.image.target }}
push: true
tags: ${{ join(matrix.image.tags) }}
labels: ${{ join(matrix.image.labels) }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-cluster:
if: always()
needs: build-images
uses: ocf/transpire/.github/workflows/cluster-ci.yml@main
with:
module_name: ${{ inputs.module_name }}
secrets:
OCF_CLUSTER_DEPLOY_KEY: ${{ secrets.OCF_CLUSTER_DEPLOY_KEY }}