-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: run UI integration tests as part of every PR (#977)
* ci: added execute_jenkins_ui_integration_tests_java.yml * ci: enabled integration tests to run on release PR
- Loading branch information
1 parent
d229149
commit a3286c7
Showing
5 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
.github/workflows/execute_jenkins_ui_integration_tests_java.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Java UI Integration | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
jenkins-ui-integration-tests-java: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
BUILD_URL: ${{ steps.trigger.outputs.BUILD_URL }} | ||
EXECUTABLE_URL: ${{ steps.get_executable_url.outputs.POLLING_URL }} | ||
env: | ||
JENKINS_URL: https://dataproctemplatesci.com/job/dataproc-templates-build/job/ad-hoc/job/ui-integration-tests-java/buildWithParameters?token=GITHUB_TOKEN&branchName=origin/${{ github.head_ref }} | ||
JOB_NAME: ui-integration-tests-java | ||
CREDS: ${{ secrets.JENKINS_CREDS }} | ||
steps: | ||
- name: Trigger Jenkins Job | ||
id: trigger | ||
run: | | ||
echo -n "BUILD_URL=$(curl -i -s -u $CREDS $JENKINS_URL | grep "location" | awk '{printf $2}' | tr -d '\r')" >> $GITHUB_OUTPUT | ||
if [[ $? != 0 ]]; then | ||
echo "API request failed. Please check the Jenkins URL and API token." | ||
exit 1 | ||
fi | ||
- name: Get the Jenkin job Execution URL | ||
id: get_executable_url | ||
env: | ||
JOB_URL: ${{ steps.trigger.outputs.BUILD_URL }}api/json | ||
run: | | ||
echo "Build Job Queue URL received on Jenkins trigger: $JOB_URL" | ||
EXECUTABLE_URL=$(curl -s -u $CREDS $JOB_URL | jq -r '.executable.url') | ||
if [[ $? != 0 ]]; then | ||
echo "API request failed. Please check the Jenkins URL and API token." | ||
exit 1 | ||
fi | ||
echo "Executable URL received on the first attempt: [$EXECUTABLE_URL]" | ||
while [[ "$EXECUTABLE_URL" == null ]]; do | ||
EXECUTABLE_URL=$(curl -s -u $CREDS $JOB_URL | jq -r '.executable.url') | ||
if [[ $? != 0 ]]; then | ||
echo "API request failed. Please check the Jenkins URL and API token." | ||
exit 1 | ||
fi | ||
done | ||
echo "POLLING_URL=$EXECUTABLE_URL" >> $GITHUB_OUTPUT | ||
- name: Wait for Jenkins Job to Complete | ||
id: status_check | ||
env: | ||
POLLING_URL: ${{ steps.get_executable_url.outputs.POLLING_URL }}api/json | ||
run: | | ||
echo "Executable URL to be polled for the triggered Jenkins job: $POLLING_URL" | ||
status="UNKNOWN" | ||
while [[ $status != "SUCCESS" ]]; do | ||
sleep 90 | ||
status=$(curl -s -u $CREDS $POLLING_URL | jq -r '.result') | ||
if [[ $? != 0 ]]; then | ||
echo "JSON data could not be parsed. Exiting..." | ||
exit 1 | ||
fi | ||
echo "Result Polled on Job Executable URL: [$status]" | ||
[ "$status" == null ] && continue | ||
if [[ $status == "FAILURE" || $status == "NOT_BUILT" || $status == "ABORTED" || $status == "UNSTABLE" ]]; then | ||
echo "Jenkins job $JOB_NAME with Build URL $JOB_URL completed with status [$status]" | ||
exit 99 | ||
fi | ||
done | ||
echo "Jenkins job $JOB_NAME with Build URL $JOB_URL completed with status $status" |