From 829ac6605c3332ec62cd433bf2e268f6f2e9da96 Mon Sep 17 00:00:00 2001 From: Dominik Rosiek Date: Wed, 28 Feb 2024 08:47:32 +0100 Subject: [PATCH] chore: add dev-builds Signed-off-by: Dominik Rosiek --- .github/workflows/dev_builds.yml | 46 ++++++++++++++++++++++++++++- .github/workflows/pull_requests.yml | 10 +++---- Makefile | 17 +++++++---- 3 files changed, 61 insertions(+), 12 deletions(-) diff --git a/.github/workflows/dev_builds.yml b/.github/workflows/dev_builds.yml index 27aaa6b68f..51628892c1 100644 --- a/.github/workflows/dev_builds.yml +++ b/.github/workflows/dev_builds.yml @@ -5,6 +5,7 @@ on: branches: - main - 'dev-build/*' + - drosiek-windows-container defaults: run: @@ -191,11 +192,54 @@ jobs: PLATFORM=${{ matrix.arch_os }} \ BUILD_TYPE_SUFFIX="-ubi" + build-windows-container-images: + name: Build Windows container + runs-on: windows-2022 + needs: + - build + strategy: + matrix: + arch_os: [ 'windows_amd64'] + steps: + - uses: actions/checkout@v4 + + - name: Extract tag + id: extract_tag + run: echo "tag=$(git rev-parse HEAD)" > $GITHUB_OUTPUT + + - name: Print tag + run: echo "Running dev build for ${{ steps.extract_tag.outputs.tag }}" + + - name: Login to Open Source ECR + run: | + USERNAME=$(powershell.exe "echo \$Env:UserName") + # remove wincred entry and fix json format by replacing }, with } + cat "C:\\Users\\${USERNAME}\\.docker\\config.json" | grep -v "wincred" | sed 's/},$/}/' > "C:\\Users\\${USERNAME}\\.docker\\config.json.tmp" + mv "C:\\Users\\${USERNAME}\\.docker\\config.json.tmp" "C:\\Users\\${USERNAME}\\.docker\\config.json" + make login + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }} + + - name: Download binary action artifact from build phase + uses: actions/download-artifact@v4 + with: + name: otelcol-sumo-${{matrix.arch_os}}.exe + path: artifacts/ + + - name: Build and push image to Open Source ECR + run: | + cp artifacts/otelcol-sumo-${{matrix.arch_os}}.exe otelcol-sumo.exe + make build-push-container-windows-dev \ + BUILD_TAG=${{ steps.extract_tag.outputs.tag }} \ + PLATFORM=${{ matrix.arch_os }} + push-docker-manifest: name: Push joint container manifest runs-on: ubuntu-20.04 needs: - build-container-images + - build-windows-container-images steps: - uses: actions/checkout@v4 @@ -240,7 +284,7 @@ jobs: run: | make push-container-manifest-dev \ BUILD_TAG=${{ steps.extract_tag.outputs.tag }} \ - PLATFORMS="linux/amd64 linux/arm64" + PLATFORMS="linux/amd64 linux/arm64 windows/amd64" - name: Push joint UBI-based container manifest for all platforms to Open Source ECR run: | diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index 733662d19c..849c571ed1 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -396,9 +396,8 @@ jobs: if: steps.changed-files.outputs.any_changed == 'true' run: | cp artifacts/otelcol-sumo-${{matrix.arch_os}}.exe otelcol-sumo.exe - make build-container-multiplatform \ - PLATFORM=${{ matrix.arch_os }} \ - DOCKERFILE=Dockerfile_windows + make build-container-windows \ + PLATFORM=${{ matrix.arch_os }} - name: Test built image if: steps.changed-files.outputs.any_changed == 'true' @@ -409,9 +408,8 @@ jobs: # if: steps.changed-files.outputs.any_changed == 'true' # run: | # cp artifacts/otelcol-sumo-fips-${{matrix.arch_os}}.exe otelcol-sumo.exe - # make build-container-multiplatform \ - # PLATFORM=${{ matrix.arch_os }} \ - # DOCKERFILE=Dockerfile_windows \ + # make build-container-windows \ + # PLATFORM=${{ matrix.arch_os }} # BUILD_TYPE_SUFFIX="-fips" # - name: Test built FIPS image diff --git a/Makefile b/Makefile index c3186f0fa0..d5e8dc0313 100644 --- a/Makefile +++ b/Makefile @@ -280,6 +280,10 @@ build-container-multiplatform-dev: build-container-multiplatform build-push-container-multiplatform-dev: REPO_URL = "$(OPENSOURCE_REPO_URL_DEV)" build-push-container-multiplatform-dev: build-push-container-multiplatform +.PHONY: build-push-container-windows-dev +build-push-container-windows-dev: DOCKERFILE = Dockerfile_windows +build-push-container-windows-dev: build-push-container-multiplatform-dev + .PHONY: push-container-manifest-dev push-container-manifest-dev: REPO_URL = "$(OPENSOURCE_REPO_URL_DEV)" push-container-manifest-dev: push-container-manifest @@ -303,6 +307,14 @@ _build-container-multiplatform: .PHONY: build-container-multiplatform build-container-multiplatform: _build-container-multiplatform +.PHONY: build-container-windows +build-container-windows: DOCKERFILE = Dockerfile_windows +build-container-windows: _build-container-multiplatform + +.PHONY: build-push-container-windows +build-push-container-windows: PUSH = --push +build-push-container-windows: build-container-windows + .PHONY: build-push-container-multiplatform build-push-container-multiplatform: PUSH = --push build-push-container-multiplatform: _build-container-multiplatform @@ -312,11 +324,6 @@ build-push-container-ubi: PUSH = --push build-push-container-ubi: DOCKERFILE = Dockerfile_ubi build-push-container-ubi: _build-container-multiplatform -.PHONY: build-push-container-windows -build-push-container-windows: PUSH = --push -build-push-container-windows: DOCKERFILE = Dockerfile_windows -build-push-container-windows: _build-container-multiplatform - .PHONY: test-built-image test-built-image: docker run --rm "$(REPO_URL):$(BUILD_TAG)" --version