Skip to content

Commit

Permalink
chore: add dev-builds
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Rosiek <[email protected]>
  • Loading branch information
Dominik Rosiek committed Feb 28, 2024
1 parent e0239b1 commit 829ac66
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 12 deletions.
46 changes: 45 additions & 1 deletion .github/workflows/dev_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
- 'dev-build/*'
- drosiek-windows-container

defaults:
run:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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: |
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 829ac66

Please sign in to comment.