forked from banzaicloud/docker-cruise-control
-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (110 loc) · 3.85 KB
/
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
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
120
121
122
123
name: CI
on:
push:
branches:
- "master"
tags:
- "[0-9].[0-9]+.[0-9]+*"
pull_request:
branches:
- "master"
env:
CONTAINER_LABELS: |
org.opencontainers.artifact.description=Linkedin's Cruise Control (https://github.com/linkedin/cruise-control)
org.opencontainers.image.url=https://github.com/banzaicloud/docker-cruise-control
org.opencontainers.image.documentation=https://github.com/banzaicloud/docker-cruise-control
org.opencontainers.image.source=https://github.com/banzaicloud/docker-cruise-control
org.opencontainers.image.title=Linkedin's Cruise Control for Koperator
org.opencontainers.image.description=Linkedin's Cruise Control container image built for Koperator (https://github.com/banzaicloud/koperator)
org.opencontainers.image.vendor=Cisco Systems
PLATFORMS: linux/amd64
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
outputs:
cruise_control_version: ${{ steps.version.outputs.version }}
cruise_control_ui_version: ${{ steps.ui-version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get Cruise Control version
id: version
run: make cruise-control-version >> "${GITHUB_OUTPUT}"
- name: Get Cruise Control UI version
id: ui-version
run: make cruise-control-ui-version >> "${GITHUB_OUTPUT}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
flavor: |
latest=false
images: |
ghcr.io/mesosphere/cruise-control
tags: |
type=sha,enable=true,format=short,prefix=
labels: ${{ env.CONTAINER_LABELS }}
- name: Build Cruise Control container image
uses: docker/build-push-action@v4
with:
build-args: |
CRUISE_CONTROL_VERSION=${{ steps.version.outputs.version }}
CRUISE_CONTROL_UI_GIT_REF=${{ steps.ui-version.outputs.version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ env.PLATFORMS }}
push: false
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run tests
run: make test
env:
CI: true
CRUISE_CONTROL_IMAGE: ${{ steps.meta.outputs.tags }}
READINESS_TIMEOUT: 3600
publish:
if: ${{ github.event_name != 'pull_request' }}
needs: build
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
flavor: |
latest=auto
images: |
ghcr.io/banzaicloud/cruise-control
tags: |
type=semver,pattern={{version}}
type=edge,branch=master
labels: ${{ env.CONTAINER_LABELS }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Publish Cruise Control container image
uses: docker/build-push-action@v4
with:
build-args: |
CRUISE_CONTROL_VERSION=${{ needs.build.outputs.cruise_control_version }}
CRUISE_CONTROL_UI_GIT_REF=${{ needs.build.outputs.cruise_control_ui_version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ env.PLATFORMS }}
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=gha
cache-to: type=gha,mode=max