From 546e31e842ea8deaa6d18f9db8e27423520e64db Mon Sep 17 00:00:00 2001 From: Pranav Gaikwad Date: Thu, 16 May 2024 17:09:38 -0400 Subject: [PATCH] add workflow step to test with bundle Signed-off-by: Pranav Gaikwad --- .github/workflows/demo-testing.yml | 39 ++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/.github/workflows/demo-testing.yml b/.github/workflows/demo-testing.yml index e70330ca..b592570b 100644 --- a/.github/workflows/demo-testing.yml +++ b/.github/workflows/demo-testing.yml @@ -13,25 +13,51 @@ jobs: env: PULL_REQUEST_BODY: ${{ github.event.pull_request.body }} run: | + echo "BUILD_ADDON=false" >> $GITHUB_OUTPUT + echo "BUILD_BUNDLE=false" >> $GITHUB_OUTPUT # if this is a PR, we should use the base branch # else, use the branch on which this is running if [ ! -z ${GITHUB_BASE_REF} ]; then echo "Using ${GITHUB_BASE_REF}" echo "API_TESTS_REF=${GITHUB_BASE_REF}" >> $GITHUB_OUTPUT echo "ADDON_REF=${GITHUB_BASE_REF}" >>$GITHUB_ENV + echo "JAVA_BUNDLE_REF=${GITHUB_BASE_REF}" >>$GITHUB_OUTPUT else echo "Using ${GITHUB_REF_NAME}" echo "API_TESTS_REF=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT echo "ADDON_REF=${GITHUB_REF_NAME}" >>$GITHUB_ENV + echo "JAVA_BUNDLE_REF=${GITHUB_REF_NAME}" >>$GITHUB_OUTPUT fi # override with explicitely set value in PR description echo "${PULL_REQUEST_BODY}" - PULL_REQUEST_NUMBER=$(echo "${PULL_REQUEST_BODY}" | grep -oP '[A|a]ddon [P|p][R|r]: \K\d+' || true) - if [ ! -z "$PULL_REQUEST_NUMBER" ]; then - echo "Using pull/${PULL_REQUEST_NUMBER} for addon" - echo "ADDON_REF=refs/pull/$PULL_REQUEST_NUMBER/merge" >>$GITHUB_ENV - fi + ADDON_PULL_REQUEST_NUMBER=$(echo "${PULL_REQUEST_BODY}" | grep -oP '[A|a]ddon [P|p][R|r]: \K\d+' || true) + if [ ! -z "$ADDON_PULL_REQUEST_NUMBER" ]; then + echo "Using pull/${ADDON_PULL_REQUEST_NUMBER} for addon" + echo "ADDON_REF=refs/pull/$ADDON_PULL_REQUEST_NUMBER/merge" >>$GITHUB_ENV + echo "BUILD_ADDON=true" >>$GITHUB_OUTPUT + fi + + JAVA_BUNDLE_PR_NUMBER=$(echo "${PULL_REQUEST_BODY}" | grep -oP '[B|b]undle [P|p][R|r]: \K\d+' || true) + if [ ! -z "$JAVA_BUNDLE_PR_NUMBER" ]; then + echo "Using bundle PR pull/${JAVA_BUNDLE_PR_NUMBER}" + echo "JAVA_BUNDLE_REF=refs/pull/$JAVA_BUNDLE_PR_NUMBER/merge" >> $GITHUB_OUTPUT + echo "BUILD_BUNDLE=true" >>$GITHUB_OUTPUT + fi + + - name: actions/checkout@v3 + if: ${{ output.BUILD_BUNDLE }} + with: + fetch-depth: 0 + repository: konveyor/java-analyzer-bundle + ref: "${{ env.JAVA_BUNDLE_REF }}" + path: java-analyzer-bundle + + - name: build java analyzer bundle image + if: ${{ output.BUILD_BUNDLE }} + working-directory: java-analyzer-bundle + run: | + podman build -t quay.io/konveyor/jdtls-server-base:latest -f Dockerfile . - uses: actions/checkout@v3 @@ -61,6 +87,7 @@ jobs: <(yq -P 'sort_keys(..)' -o=props <(cat demo-dep-output.yaml)) - uses: actions/checkout@v3 + if: ${{ output.BUILD_ADDON }} with: fetch-depth: 0 repository: konveyor/tackle2-addon-analyzer @@ -68,12 +95,14 @@ jobs: path: tackle2-addon-analyzer - name: Build addon and save image + if: ${{ output.BUILD_ADDON }} working-directory: tackle2-addon-analyzer run: | IMG=quay.io/konveyor/tackle2-addon-analyzer:latest make image-podman podman save -o /tmp/tackle2-addon-analyzer.tar quay.io/konveyor/tackle2-addon-analyzer:latest - name: Upload image as artifact + if: ${{ output.BUILD_ADDON }} uses: actions/upload-artifact@v3 with: name: tackle2-addon-analyzer