Skip to content

Commit fbe4726

Browse files
authored
Build and push build-image (#55)
Signed-off-by: Friedrich Gonzalez <friedrichg@gmail.com>
1 parent a9fec63 commit fbe4726

File tree

4 files changed

+77
-4
lines changed

4 files changed

+77
-4
lines changed

.github/workflows/build-image.yaml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build Image
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'build-image/Dockerfile'
8+
- '.github/workflows/build-image.yaml'
9+
pull_request:
10+
branches: [ main ]
11+
paths:
12+
- 'build-image/Dockerfile'
13+
- '.github/workflows/build-image.yaml'
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
name: Checkout
21+
22+
- name: Build & save image
23+
run: make build-image save-build-image
24+
25+
- name: Upload Docker Images Artifact
26+
uses: actions/upload-artifact@v4
27+
with:
28+
name: build-image
29+
path: ./build-image.tar
30+
if-no-files-found: error
31+
32+
push:
33+
if: github.ref == 'refs/heads/main' && github.repository == 'cortexproject/cortex-jsonnet'
34+
needs: build
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
name: Checkout
39+
40+
- name: Download Docker Images Artifacts
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: build-image
44+
45+
- name: Load image
46+
run: make load-build-image
47+
48+
- name: Login to Quay.io
49+
uses: docker/#-action@v3
50+
with:
51+
registry: quay.io
52+
username: ${{secrets.QUAY_REGISTRY_USER}}
53+
password: ${{secrets.QUAY_REGISTRY_PASSWORD}}
54+
55+
- name: Push image
56+
run: make publish-build-image

.github/workflows/ci.yaml

+14-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ name: CI
33
on:
44
push:
55
branches: [ main ]
6+
paths-ignore:
7+
- 'build-image/Dockerfile'
8+
- '.github/workflows/build-image.yaml'
69
pull_request:
710
branches: [ main ]
11+
paths-ignore:
12+
- 'build-image/Dockerfile'
13+
- '.github/workflows/build-image.yaml'
814

915
jobs:
1016
lint:
@@ -15,12 +21,13 @@ jobs:
1521
name: Checkout
1622
with:
1723
fetch-depth: 0
18-
24+
1925
- name: "Lint mixin"
2026
run: make lint-mixin
21-
27+
2228
- name: "Lint playbooks"
2329
run: make lint-playbooks
30+
2431
build:
2532
runs-on: ubuntu-latest
2633
container: quay.io/cortexproject/cortex-jsonnet-build-image:e158eda
@@ -29,9 +36,10 @@ jobs:
2936
name: Checkout
3037
with:
3138
fetch-depth: 0
32-
39+
3340
- name: "Build mixin"
3441
run: make build-mixin
42+
3543
readme:
3644
runs-on: ubuntu-latest
3745
container: quay.io/cortexproject/cortex-jsonnet-build-image:e158eda
@@ -40,10 +48,12 @@ jobs:
4048
name: Checkout
4149
with:
4250
fetch-depth: 0
43-
51+
4452
- name: "Test readme s3"
4553
run: make test-readme/s3
54+
4655
- name: "Test readme azure"
4756
run: make test-readme/azure
57+
4858
- name: "Test readme gcs"
4959
run: make test-readme/gcs

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ cortex-mixin/out
33
cortex-mixin/vendor
44
/test-readme/
55
.vscode
6+
build-image.tar

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ fmt:
3434
build-image:
3535
docker build -t quay.io/cortexproject/cortex-jsonnet-build-image:$(shell git rev-parse --short HEAD) build-image
3636

37+
save-build-image:
38+
docker save quay.io/cortexproject/cortex-jsonnet-build-image:$(shell git rev-parse --short HEAD) > build-image.tar
39+
40+
load-build-image:
41+
docker load < build-image.tar
42+
3743
publish-build-image:
3844
docker push quay.io/cortexproject/cortex-jsonnet-build-image:$(shell git rev-parse --short HEAD)
3945

0 commit comments

Comments
 (0)