Skip to content

Commit

Permalink
Build and push build-image
Browse files Browse the repository at this point in the history
Signed-off-by: Friedrich Gonzalez <[email protected]>
  • Loading branch information
friedrichg committed Jun 16, 2024
1 parent a9fec63 commit 334ea70
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 4 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: build-image

on:
push:
branches: [ main ]
paths:
- 'build-image/Dockerfile'
- '.github/workflows/build-image.yaml'
pull_request:
branches: [ main ]
paths:
- 'build-image/Dockerfile'
- '.github/workflows/build-image.yaml'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout

- name: Build & save image
run: make build-image save-build-image

- name: Upload Docker Images Artifact
uses: actions/upload-artifact@v4
with:
name: build-image
path: ./build-image.tar
if-no-files-found: error

push:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout

- name: Download Docker Images Artifacts
uses: actions/download-artifact@v4
with:
name: build-image

- name: Load image
run: make load-build-image

- name: Push image
run: make publish-build-image
18 changes: 14 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ name: CI
on:
push:
branches: [ main ]
paths-ignore:
- 'build-image/Dockerfile'
- '.github/workflows/build-image.yaml'
pull_request:
branches: [ main ]
paths-ignore:
- 'build-image/Dockerfile'
- '.github/workflows/build-image.yaml'

jobs:
lint:
Expand All @@ -15,12 +21,13 @@ jobs:
name: Checkout
with:
fetch-depth: 0

- name: "Lint mixin"
run: make lint-mixin

- name: "Lint playbooks"
run: make lint-playbooks

build:
runs-on: ubuntu-latest
container: quay.io/cortexproject/cortex-jsonnet-build-image:e158eda
Expand All @@ -29,9 +36,10 @@ jobs:
name: Checkout
with:
fetch-depth: 0

- name: "Build mixin"
run: make build-mixin

readme:
runs-on: ubuntu-latest
container: quay.io/cortexproject/cortex-jsonnet-build-image:e158eda
Expand All @@ -40,10 +48,12 @@ jobs:
name: Checkout
with:
fetch-depth: 0

- name: "Test readme s3"
run: make test-readme/s3

- name: "Test readme azure"
run: make test-readme/azure

- name: "Test readme gcs"
run: make test-readme/gcs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ cortex-mixin/out
cortex-mixin/vendor
/test-readme/
.vscode
build-image.tar
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ fmt:
build-image:
docker build -t quay.io/cortexproject/cortex-jsonnet-build-image:$(shell git rev-parse --short HEAD) build-image

save-build-image:
docker save quay.io/cortexproject/cortex-jsonnet-build-image:$(shell git rev-parse --short HEAD) > build-image.tar

load-build-image:
docker load < build-image.tar

publish-build-image:
docker push quay.io/cortexproject/cortex-jsonnet-build-image:$(shell git rev-parse --short HEAD)

Expand Down

0 comments on commit 334ea70

Please sign in to comment.