Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
mfaizanse committed Jan 16, 2024
1 parent 1ec0d60 commit a599e28
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ on:
jobs:
wait-until-build-succeeds:
runs-on: ubuntu-latest
outputs:
image-name: ${{ steps.pull-extract-image.outputs.image_name }}
steps:
- uses: actions/checkout@v4

- name: Wait for the 'pull-eventing-manager-build' job to succeed
id: pr-wait-build
id: pull-wait-build
if: github.event_name == 'pull_request'
uses: kyma-project/wait-for-commit-status-action@2b3ffe09af8b6f40e1213d5fb7f91a7bd41ffb20
with:
Expand All @@ -45,6 +47,7 @@ jobs:
GITHUB_REPO: "eventing-manager"

- name: Wait for the 'post-eventing-manager-build' job to succeed
id: push-wait-build
if: github.event_name == 'push'
uses: kyma-project/wait-for-commit-status-action@2b3ffe09af8b6f40e1213d5fb7f91a7bd41ffb20
with:
Expand All @@ -59,16 +62,18 @@ jobs:
GITHUB_REPO: "eventing-manager"

- name: Extract container image name from build logs (pull)
id: pull-extract-image
if: github.event_name == 'pull_request'
env:
COMMIT_STATUS_JSON: "${{ steps.pr-wait-build.outputs.json }}"
COMMIT_STATUS_JSON: "${{ steps.pull-wait-build.outputs.json }}"
BUILD_JOB_NAME: "pull-eventing-manager-build"
PR_NUMBER: "${{ github.event.number }}"
run: |
./scripts/extract_image_from_build_logs.sh
export IMAGE_NAME="$(cat image.name)"
echo "IMAGE_NAME: ${IMAGE_NAME}"
echo "Validate that the image exists:"
docker pull ${IMAGE_NAME}
: ### export value to job output
echo "image_name=${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
nats:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -178,12 +183,11 @@ jobs:
kubectl get peerauthentications.security.istio.io -A -o yaml
backend-switching:
# needs: wait-until-build-succeeds
# if: github.event_name == 'pull_request'
if: false
needs: wait-until-build-succeeds
if: github.event_name == 'pull_request'
uses: "./.github/workflows/e2e-backend-switching-reuseable.yml"
with:
eventing-manager-image: europe-docker.pkg.dev/kyma-project/dev/eventing-manager:latest
eventing-manager-image: ${{needs.wait-until-build-succeeds.outputs.image-name}}
kube-version: "1.26.9"
cluster-name-prefix: "ghem-"
secrets: inherit
13 changes: 11 additions & 2 deletions scripts/extract_image_from_build_logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
# "updated_at": "2023-07-18T11:39:23Z"
# }

COMMIT_STATUS_JSON=${PULL_COMMIT_STATUS_JSON}
if [[ -z "${PR_NUMBER}" ]]; then
COMMIT_STATUS_JSON=${PUSH_COMMIT_STATUS_JSON}
fi

## check if required ENVs are provided.
if [[ -z "${COMMIT_STATUS_JSON}" ]]; then
echo "ERROR: COMMIT_STATUS_JSON is not set!"
Expand Down Expand Up @@ -53,5 +58,9 @@ curl -s -L -o ${LOGS_FILE_NAME} ${LOGS_FILE_URL}

## extract the image name from build logs.
export IMAGE_NAME=$(cat ${LOGS_FILE_NAME} | grep "Successfully built image:" | awk -F " " '{print $NF}')
echo "IMAGE_NAME: ${IMAGE_NAME}"
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV

## validate if image exists
echo "Validate that image: ${IMAGE_NAME} exists!"
docker pull ${IMAGE_NAME}

echo ${IMAGE_NAME} > image.name

0 comments on commit a599e28

Please sign in to comment.