diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml new file mode 100644 index 0000000..6d82f7c --- /dev/null +++ b/.github/workflows/build-image.yaml @@ -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 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9e48451..9034101 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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: @@ -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 @@ -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 @@ -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 diff --git a/.gitignore b/.gitignore index 41d67a0..4c7277c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ cortex-mixin/out cortex-mixin/vendor /test-readme/ .vscode +build-image.tar diff --git a/Makefile b/Makefile index 7ddbd64..a1f0de7 100644 --- a/Makefile +++ b/Makefile @@ -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)