Skip to content

chore: Introduce all checks passed workflow (#135) #832

chore: Introduce all checks passed workflow (#135)

chore: Introduce all checks passed workflow (#135) #832

name: Build Image
on:
pull_request_target:
types: [opened, edited, synchronize, reopened, ready_for_review]
branches:
- "main"
- "release-*"
push:
branches:
- "main"
- "release-*"
jobs:
envs:
runs-on: ubuntu-latest
outputs:
build-args: ${{ steps.prepare-envs.outputs.build-args }}
tags: ${{ steps.create-tags.outputs.tags }}
otel-version: ${{ steps.load-envs.outputs.OTEL_VERSION }}
otel-contrib-version: ${{ steps.load-envs.outputs.OTEL_CONTRIB_VERSION }}
pr-tag: ${{ steps.create-tags.outputs.PR_TAG }}
push-tag: ${{ steps.create-tags.outputs.PUSH_TAG }}
steps:
- name: Checkout code
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout code
if: github.event_name == 'push'
uses: actions/checkout@v4
- name: prepare envs
id: prepare-envs
run: |
{
echo 'build-args<<BUILD_ARGS'
cat otel-collector/envs
echo BUILD_ARGS
} >> "$GITHUB_OUTPUT"
- name: load envs into output
id: load-envs
run: |
cat otel-collector/envs >> "$GITHUB_OUTPUT"
- name: print env context
run: echo "${{ steps.prepare-envs.outputs.build-args }}"
- name: create tags
id: create-tags
run: |
if [[ $GITHUB_EVENT_NAME == 'push' ]]; then
echo 'TAGS="${{ steps.load-envs.outputs.OTEL_VERSION }}-${{ github.ref_name }}"' >> "$GITHUB_OUTPUT"
else
echo 'TAGS="PR-${{ github.event.pull_request.number }}"' >> "$GITHUB_OUTPUT"
fi
echo 'PUSH_TAG="${{ steps.load-envs.outputs.OTEL_VERSION }}-${{ github.ref_name }}"' >> "$GITHUB_OUTPUT"
echo 'PR_TAG="PR-${{ github.event.pull_request.number }}"' >> "$GITHUB_OUTPUT"
build-image:
needs: envs
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main # Usage: kyma-project/test-infra/.github/workflows/image-builder.yml@main
with:
name: kyma-otel-collector
dockerfile: otel-collector/Dockerfile
context: .
build-args: ${{ needs.envs.outputs.build-args }}
tags: ${{ needs.envs.outputs.tags }}
list-images:
needs: build-image
runs-on: ubuntu-latest
steps:
- name: List images
run: |
echo "${{ needs.build-image.outputs.images }}"