Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: added github action based build jobs #167

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/pull-build-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Pull Build Image

on:
pull_request_target:
types: [opened, edited, synchronize, reopened, ready_for_review]

permissions:
id-token: write # This is required for requesting the JWT token
contents: read # This is required for actions/checkout

jobs:
build:
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main
with:
name: eventing-publisher-proxy
dockerfile: Dockerfile
context: .
export-tags: true
test-image:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install jq
run: sudo apt-get install jq

- name: Extract image name from JSON
id: extract-image
run: |
echo "IMAGE_NAME=$(echo '${{ needs.build.outputs.images }}' | jq -r '.[0]')" >> $GITHUB_ENV
- name: Test image
run: ./scripts/shell/run-and-check-container.sh "$IMAGE_NAME" PR-${{ github.event.number }}-container
39 changes: 39 additions & 0 deletions .github/push-build-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Push Build Image

on:
push:
branches:
- "main"
- "release-*"
paths-ignore:
- "docs/**"

permissions:
id-token: write # This is required for requesting the JWT token
contents: read # This is required for actions/checkout

jobs:
compute-tags:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.get_tag.outputs.TAGS }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get the latest tag
id: get_tag
run: |
{
echo 'TAGS<<EOF'
echo "${{ github.sha }}"
echo "${{ github.ref_name}}"
echo EOF
} >> "$GITHUB_OUTPUT"
build:
needs: compute-tags
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main
with:
name: eventing-publisher-proxy
dockerfile: Dockerfile
context: .
tags: ${{ needs.compute-tags.outputs.tags }}
37 changes: 37 additions & 0 deletions .github/tag-build-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Tag Build Image

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+' # This will trigger the workflow when a tag (x.y.z) is pushed.

permissions:
id-token: write # This is required for requesting the JWT token
contents: read # This is required for actions/checkout

jobs:
compute-tags:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.get_tag.outputs.TAGS }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get the latest tag
id: get_tag
run: |
{
echo 'TAGS<<EOF'
echo "${{ github.sha }}"
echo "${{ github.ref_name}}"
echo EOF
} >> "$GITHUB_OUTPUT"
build:
name: build-${{ github.ref_name }} # The release pipeline will check the status of this job by this name format (e.g. build-1.0.1).
needs: compute-tags
uses: kyma-project/test-infra/.github/workflows/image-builder.yml@main
with:
name: eventing-publisher-proxy
dockerfile: Dockerfile
context: .
tags: ${{ needs.compute-tags.outputs.tags }}
Loading