-
Notifications
You must be signed in to change notification settings - Fork 23
119 lines (104 loc) · 3.8 KB
/
image.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: image
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
image_push:
type: boolean
description: 'Push images to Container Registry'
required: false
default: false
pull_request:
paths-ignore:
- "docs/**"
- README.md
push:
branches:
- main
tags:
- "v*"
paths-ignore:
- "docs/**"
- README.md
jobs:
service:
runs-on: ubuntu-latest
strategy:
matrix:
release:
- yoga
- zed
- "2023.1"
steps:
- name: Configure Buildkit
uses: docker/setup-buildx-action@v2
- name: Checkout project
uses: actions/checkout@v3
- name: Build wheels
run: make build
- name: Start HTTP server with wheels
run: python3 -m http.server 8000 --directory dist &
- name: Setup environment variables
run: |-
echo WHEEL_URL=http://$(ip addr show eth0 | grep -Po 'inet \K[\d.]+'):8000/$(ls -1 dist | grep whl) >> $GITHUB_ENV
echo PROJECT_REF=$(curl -Ls https://github.com/vexxhost/docker-openstack-magnum/raw/main/manifest.yml | yq '."${{ matrix.release }}".sha') >> $GITHUB_ENV
- name: Authenticate with Quay.io
uses: docker/login-action@v2
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.image_push == true) }}
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: Build image
uses: docker/build-push-action@v3
with:
context: https://github.com/vexxhost/docker-openstack-magnum.git
push: ${{ github.event_name == 'push' || inputs.image_push == true }}
cache-from: type=gha,scope=${{ env.PROJECT_REF }}-${{ github.sha }}
cache-to: type=gha,mode=max,scope=${{ env.PROJECT_REF }}-${{ github.sha }}
network: host
tags: |-
quay.io/vexxhost/magnum-cluster-api:${{ env.PROJECT_REF }}-${{ github.sha }}
build-args: |-
BUILDER_IMAGE=quay.io/vexxhost/openstack-builder-jammy
RUNTIME_IMAGE=quay.io/vexxhost/openstack-runtime-jammy
RELEASE=${{ matrix.release }}
PROJECT=magnum
PROJECT_REPO=https://github.com/vexxhost/magnum
PROJECT_REF=${{ env.PROJECT_REF }}
DIST_PACKAGES=haproxy
PIP_PACKAGES=cryptography python-binary-memcached ${{ env.WHEEL_URL }}
- name: Promote image
uses: akhilerm/[email protected]
if: github.event_name == 'push'
with:
src: quay.io/vexxhost/magnum-cluster-api:${{ env.PROJECT_REF }}-${{ github.sha }}
dst: quay.io/vexxhost/magnum-cluster-api:${{ matrix.release }}
registry:
runs-on: ubuntu-latest
steps:
- name: Configure Buildkit
uses: docker/setup-buildx-action@v2
- name: Checkout project
uses: actions/checkout@v3
- name: Generate image metadata
id: meta
uses: docker/metadata-action@v4
with:
images: quay.io/vexxhost/magnum-cluster-api-registry
- name: Authenticate with Quay.io
uses: docker/login-action@v2
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.image_push == true) }}
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: Build image
uses: docker/build-push-action@v3
with:
target: registry
push: ${{ github.event_name == 'push' || inputs.image_push == true }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}