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 9a00e0c
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 4 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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: Login to Quay.io
run: |
docker login -u "$QUAY_REGISTRY_USER" -p "$QUAY_REGISTRY_PASSWORD" quay.io
env:
QUAY_REGISTRY_USER: ${{secrets.QUAY_REGISTRY_USER}}
QUAY_REGISTRY_PASSWORD: ${{secrets.QUAY_REGISTRY_PASSWORD}}

- 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 9a00e0c

Please sign in to comment.