Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and push build-image #55

Merged
merged 1 commit into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
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:
if: github.ref == 'refs/heads/main' && github.repository == 'cortexproject/cortex-jsonnet'
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
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{secrets.QUAY_REGISTRY_USER}}
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