From 4e60df21be9c73a153234dd8e4b2b4674052a2f4 Mon Sep 17 00:00:00 2001 From: Friedrich Gonzalez Date: Sun, 16 Jun 2024 18:39:14 +0200 Subject: [PATCH] Build and push build-image Signed-off-by: Friedrich Gonzalez --- .github/workflows/build-image.yaml | 43 ++++++++++++++++++++++++++++++ .github/workflows/ci.yaml | 17 +++++++++--- .gitignore | 1 + Makefile | 3 +++ 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build-image.yaml diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml new file mode 100644 index 0000000..04f6aef --- /dev/null +++ b/.github/workflows/build-image.yaml @@ -0,0 +1,43 @@ +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-image + + - name: Upload Docker Images Artifact + uses: actions/upload-artifact@v4 + with: + name: build-image + path: ./build-image.tar + + push: + 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: "Push image" + run: ls -l * diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9e48451..6d707af 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,10 +21,10 @@ jobs: name: Checkout with: fetch-depth: 0 - + - name: "Lint mixin" run: make lint-mixin - + - name: "Lint playbooks" run: make lint-playbooks build: @@ -29,9 +35,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 +47,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..f6ccfa5 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,9 @@ 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 + publish-build-image: docker push quay.io/cortexproject/cortex-jsonnet-build-image:$(shell git rev-parse --short HEAD)