From e7284d44341a231a96a10e93b782953827345086 Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 09:55:51 -0500 Subject: [PATCH 01/58] Jira writeback integration --- azure-pipelines-automated-testing.yml | 434 ++++++++++++++++++++++++++ devops/scripts/jira_writeback.sh | 144 +++++++++ 2 files changed, 578 insertions(+) create mode 100644 azure-pipelines-automated-testing.yml create mode 100755 devops/scripts/jira_writeback.sh diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml new file mode 100644 index 00000000..31b34b58 --- /dev/null +++ b/azure-pipelines-automated-testing.yml @@ -0,0 +1,434 @@ +trigger: + branches: + include: [ develop, release/* ] + paths: + exclude: + - deployment/* + include: + - "*" +pr: + branches: + include: [ '*' ] + paths: + exclude: + - deployment/* + include: + - "*" + +resources: + containers: + - container: node + image: packagerepository.sagaws.net:8082/safelite/node-build:18 + - container: awscli + image: packagerepository.sagaws.net:8082/safelite/awscli2-build:3.9 + repositories: + - repository: AzureDevOps + type: github + name: Safelite/AzureDevOps + endpoint: Safelite + ref: refs/tags/t5.5.40 + +variables: + - group: Digital-Infrastructure + - group: ISS-BuildBranches + - name: dockerImageName + value: 'playwright-tests' + - name: imageTag + value: '$(Build.BuildId)' + - name: totalShards + value: 40 # TODO: Temporarily changed to 40, change back to 4 + +stages: + # PR's + - ${{ if or(eq(variables['Build.Reason'], 'PullRequest'), eq(1,1)) }}: # TODO: Temporarily changed to always be true, change back + - stage: TestPr + displayName: Run Tests For PullRequest + jobs: + - template: templates/digital/vue-jest-run-unit-tests.yml@AzureDevOps + parameters: + nodeContainer: node + npmLocation: $(Build.SourcesDirectory) + testResultsFile: junit.xml + summaryFileLocation: $(Build.SourcesDirectory)/coverage/cobertura-coverage.xml + - job: playwright_tests + continueOnError: true + strategy: + matrix: + shard1: + shardNumber: 1 + shard2: + shardNumber: 2 + shard3: + shardNumber: 3 + shard4: + shardNumber: 4 + + steps: + - task: Docker@2 + displayName: 'Build Docker Image' + inputs: + command: build + dockerfile: Dockerfile.playwright + repository: $(dockerImageName) + tags: $(imageTag) + arguments: '--no-cache --pull' + + - script: | + # Create container and run tests + container_id=$(docker create \ + --ipc=host \ + -e CCIS_API_AUTH=$(CCIS_API_AUTH) \ + -e BASE_URL=$(BASE_URL) \ + -e CCIS_API_URL=$(CCIS_API_URL) \ + -e ADMIN_SERVICE_API_URL=$(ADMIN_SERVICE_API_URL) \ + -e SHARD=$(shardNumber) \ + -e CI=true \ + -e NODE_ENV=$(NODE_ENV) \ + $(dockerImageName):$(imageTag) \ + npx concurrently -k -n "server,playwright"\ + "sed -i \"s|^process\.env\.VUE_APP_CONSUMER_CF_DISTRO = .*|process\.env\.VUE_APP_CONSUMER_CF_DISTRO='https://digitalapi.test.safelite.io'|\" \"./vue.config.js\" && echo \"Updated config file to use TEST APIs\" && npm run serve -- --port=8080"\ + "npx wait-on http://localhost:8080 && npm run test:playwright -- --shard=$(shardNumber)/$(totalShards) --reporter=list,blob --grep \"@smoke | @Advanced\"") + + # Start container and stream logs + + echo "Starting tests for shard $(shardNumber)..." + docker start -a $container_id + + # Create directory for test results + echo "Creating test results directory..." + mkdir -p $(System.DefaultWorkingDirectory)/blob-reports/shard-$(shardNumber) + + # Copy test results from container + echo "Copying test results..." + docker cp $container_id:/app/blob-report/. $(System.DefaultWorkingDirectory)/blob-reports/shard-$(shardNumber)/ + + # Remove container + echo "Cleaning up container..." + docker rm $container_id + + # Check if tests failed + if [ $? -ne 0 ]; then + echo "Tests failed in shard $(shardNumber)!" + exit 1 + fi + displayName: 'Run Playwright Tests - Shard $(shardNumber)' + + - task: PublishPipelineArtifact@1 + displayName: 'Publish Test Reports - Shard $(shardNumber)' + condition: always() + inputs: + targetPath: '$(System.DefaultWorkingDirectory)/blob-reports/shard-$(shardNumber)' + artifact: 'playwright-report-shard-$(shardNumber)' + publishLocation: 'pipeline' + + - script: | + docker rmi $(dockerImageName):$(imageTag) -f + displayName: 'Cleanup Docker Image' + condition: always() + + - job: download_and_merge_reports + container: + image: mcr.microsoft.com/playwright:v1.48.0-noble + dependsOn: playwright_tests + steps: + - task: DownloadPipelineArtifact@2 + inputs: + targetPath: '$(System.DefaultWorkingDirectory)/playwright-reports' + - script: | + npm i ortoni-report && + for dir in $(System.DefaultWorkingDirectory)/playwright-reports/*/; do + if [ -d "$dir" ]; then + mv "$dir"* $(System.DefaultWorkingDirectory)/playwright-reports/ + rmdir "$dir" + fi + done + npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports + ls + displayName: merge_reports + env: + PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" + - script: | + $(System.DefaultWorkingDirectory)/jira_writeback.sh + add_comment() $(Build.SourceBranchName) "AUTOMATED TEST RUN: $(date)" $(System.DefaultWorkingDirectory)/ortoni-report/index.html + displayName: publish_results_to_jira + env: + JIRA_API_KEY: $(JIRA_API_KEY) + + # TODO: Enable later when working on PR gate + # - task: PublishTestResults@2 + # displayName: 'Publish test results' + # inputs: + # searchFolder: 'test-results' + # testResultsFormat: 'JUnit' + # testResultsFiles: 'results.xml' + # mergeTestResults: true + # failTaskOnFailedTests: false + # testRunTitle: 'Playwright Tests' + # condition: succeededOrFailed() + + - task: PublishPipelineArtifact@1 + displayName: 'Publish Merged Report' + condition: always() + inputs: + targetPath: '$(System.DefaultWorkingDirectory)/ortoni-report' + artifact: 'playwright-merged-report' + publishLocation: 'pipeline' + + - ${{ else }}: + # Dev Build/Deploy + - stage: Dev + condition: eq(variables['Build.SourceBranch'], variables['dev-branch'] ) + variables: + - group: ISS-Dev + jobs: + - deployment: devBuildDeployment + displayName: Build and Deploy ISS - Dev + environment: digitalCloud-dev + container: node + workspace: + clean: all + strategy: + runOnce: + deploy: + steps: + - checkout: self + clean: true + - task: CopyFiles@2 + inputs: + SourceFolder: 'public/apple-pay/dev' + Contents: '**' + TargetFolder: 'public/.well-known' + CleanTargetFolder: true + - task: DeleteFiles@1 + inputs: + SourceFolder: 'public/apple-pay' + Contents: '**' + RemoveSourceFolder: true + - template: templates/digital/step-build-vue.yml@AzureDevOps + parameters: + buildOutputDir: dist + environment: Dev + - template: templates/digital/step-deploy-vue.yml@AzureDevOps + parameters: + artifactName: vueDistDev + awsProfile: $(devDeploymentProfile) + deployBuckets: + safelite-dev-iss-us-east-2: + clearFolder: true + deployFolder: '' + region: us-east-2 + safelite-dev-iss-us-east-1: + clearFolder: true + deployFolder: '' + region: us-east-1 + appDeployVariables: + __VUE_APP_CONSUMER_CF_DISTRO__: $(__VUE_APP_CONSUMER_CF_DISTRO__) + __VUE_APP_CURRENT_ENVIRONMENT__: $(__VUE_APP_CURRENT_ENVIRONMENT__) + __VUE_APP_CUSTOMER_PORTAL_URL__: $(__VUE_APP_CUSTOMER_PORTAL_URL__) + __VUE_APP_GOOGLE_PLACES_API_KEY__: $(__VUE_APP_GOOGLE_PLACES_API_KEY__) + __VUE_APP_SAFELITE_HOP__: $(__VUE_APP_SAFELITE_HOP__) + indexDeployVariables: + __VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__) + __VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__) + __VUE_APP_GOOGLE_MAPS_API_SCRIPT__: $(__VUE_APP_GOOGLE_MAPS_API_SCRIPT__) + - template: templates/digital/invalidate-cloudfront-cache.yml@AzureDevOps + parameters: + awsCliContainer: awscli + distributionId: $(cfDistributionId) + paths: /* + awsProfile: $(devDeploymentProfile) + + # Test Build/Deploy + - stage: Test + condition: eq(variables['Build.SourceBranch'], variables['test-branch'] ) + variables: + - group: ISS-Test + jobs: + - deployment: testBuildDeployment + displayName: Build and Deploy ISS - Test + environment: NoApproval-All + container: node + workspace: + clean: all + strategy: + runOnce: + deploy: + steps: + - checkout: self + clean: true + - task: CopyFiles@2 + inputs: + SourceFolder: 'public/apple-pay/test' + Contents: '**' + TargetFolder: 'public/.well-known' + CleanTargetFolder: true + - task: DeleteFiles@1 + inputs: + SourceFolder: 'public/apple-pay' + Contents: '**' + RemoveSourceFolder: true + - template: templates/digital/step-build-vue.yml@AzureDevOps + parameters: + buildOutputDir: dist + environment: Test + - template: templates/digital/step-deploy-vue.yml@AzureDevOps + parameters: + artifactName: vueDistTest + awsProfile: $(sysDeploymentProfile) + deployBuckets: + safelite-sys-iss-us-east-1: + clearFolder: true + deployFolder: "" + region: us-east-1 + safelite-sys-iss-us-east-2: + clearFolder: true + deployFolder: "" + region: us-east-2 + appDeployVariables: + __VUE_APP_CONSUMER_CF_DISTRO__: $(__VUE_APP_CONSUMER_CF_DISTRO__) + __VUE_APP_CURRENT_ENVIRONMENT__: $(__VUE_APP_CURRENT_ENVIRONMENT__) + __VUE_APP_CUSTOMER_PORTAL_URL__: $(__VUE_APP_CUSTOMER_PORTAL_URL__) + __VUE_APP_GOOGLE_PLACES_API_KEY__: $(__VUE_APP_GOOGLE_PLACES_API_KEY__) + __VUE_APP_SAFELITE_HOP__: $(__VUE_APP_SAFELITE_HOP__) + indexDeployVariables: + __VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__) + __VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__) + __VUE_APP_GOOGLE_MAPS_API_SCRIPT__: $(__VUE_APP_GOOGLE_MAPS_API_SCRIPT__) + - template: templates/digital/invalidate-cloudfront-cache.yml@AzureDevOps + parameters: + awsCliContainer: awscli + distributionId: $(cfDistributionId) + paths: /* + awsProfile: $(sysDeploymentProfile) + + # QA Build/Deploy + - stage: QA + condition: eq(variables['Build.SourceBranch'], variables['qa-branch'] ) + variables: + - group: ISS-QA + jobs: + - deployment: qaBuildDeployment + displayName: Build and Deploy ISS - QA + environment: NoApproval-All + container: node + workspace: + clean: all + strategy: + runOnce: + deploy: + steps: + - checkout: self + clean: true + - task: CopyFiles@2 + inputs: + SourceFolder: 'public/apple-pay/qa' + Contents: '**' + TargetFolder: 'public/.well-known' + CleanTargetFolder: true + - task: DeleteFiles@1 + inputs: + SourceFolder: 'public/apple-pay' + Contents: '**' + RemoveSourceFolder: true + - template: templates/digital/step-build-vue.yml@AzureDevOps + parameters: + buildOutputDir: dist + environment: Qa + - template: templates/digital/step-deploy-vue.yml@AzureDevOps + parameters: + artifactName: vueDistQa + awsProfile: $(qaDeploymentProfile) + deployBuckets: + safelite-qa-iss-us-east-1: + clearFolder: true + deployFolder: "" + region: us-east-1 + safelite-qa-iss-us-east-2: + clearFolder: true + deployFolder: "" + region: us-east-2 + appDeployVariables: + __VUE_APP_CONSUMER_CF_DISTRO__: $(__VUE_APP_CONSUMER_CF_DISTRO__) + __VUE_APP_CURRENT_ENVIRONMENT__: $(__VUE_APP_CURRENT_ENVIRONMENT__) + __VUE_APP_CUSTOMER_PORTAL_URL__: $(__VUE_APP_CUSTOMER_PORTAL_URL__) + __VUE_APP_GOOGLE_PLACES_API_KEY__: $(__VUE_APP_GOOGLE_PLACES_API_KEY__) + __VUE_APP_SAFELITE_HOP__: $(__VUE_APP_SAFELITE_HOP__) + indexDeployVariables: + __VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__) + __VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__) + __VUE_APP_GOOGLE_MAPS_API_SCRIPT__: $(__VUE_APP_GOOGLE_MAPS_API_SCRIPT__) + - template: templates/digital/invalidate-cloudfront-cache.yml@AzureDevOps + parameters: + awsCliContainer: awscli + distributionId: $(cfDistributionId) + paths: /* + awsProfile: $(qaDeploymentProfile) + + # Prod Build/Deploy + - stage: Prod + condition: succeeded('QA') + variables: + - group: ISS-Prod + jobs: + - deployment: prodBuildDeployment + displayName: Build and Deploy ISS - Prod + environment: digitalCloud-prod + container: node + workspace: + clean: all + strategy: + runOnce: + deploy: + steps: + - checkout: self + clean: true + - task: CopyFiles@2 + inputs: + SourceFolder: 'public/apple-pay/prod' + Contents: '**' + TargetFolder: 'public/.well-known' + CleanTargetFolder: true + - task: DeleteFiles@1 + inputs: + SourceFolder: 'public/apple-pay' + Contents: '**' + RemoveSourceFolder: true + - template: templates/digital/step-build-vue.yml@AzureDevOps + parameters: + buildOutputDir: dist + environment: Prod + - template: templates/digital/step-deploy-vue.yml@AzureDevOps + parameters: + artifactName: vueDistProd + awsProfile: $(prodDeploymentProfile) + deployBuckets: + safelite-prod-iss-us-east-1: + clearFolder: true + deployFolder: "" + region: us-east-1 + safelite-prod-iss-us-east-2: + clearFolder: true + deployFolder: "" + region: us-east-2 + appDeployVariables: + __VUE_APP_CONSUMER_CF_DISTRO__: $(__VUE_APP_CONSUMER_CF_DISTRO__) + __VUE_APP_CURRENT_ENVIRONMENT__: $(__VUE_APP_CURRENT_ENVIRONMENT__) + __VUE_APP_CUSTOMER_PORTAL_URL__: $(__VUE_APP_CUSTOMER_PORTAL_URL__) + __VUE_APP_GOOGLE_PLACES_API_KEY__: $(__VUE_APP_GOOGLE_PLACES_API_KEY__) + __VUE_APP_SAFELITE_HOP__: $(__VUE_APP_SAFELITE_HOP__) + indexDeployVariables: + __VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__) + __VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__) + __VUE_APP_GOOGLE_MAPS_API_SCRIPT__: $(__VUE_APP_GOOGLE_MAPS_API_SCRIPT__) + - template: templates/digital/invalidate-cloudfront-cache.yml@AzureDevOps + parameters: + awsCliContainer: awscli + distributionId: $(cfDistributionId) + paths: /* + awsProfile: $(prodDeploymentProfile) + - template: templates/digital/auto-tag.yml@AzureDevOps + parameters: + dependsOn: prodBuildDeployment + userName: SafeliteAzureDevops + userEmail: githubazuredevops@safelite.com + diff --git a/devops/scripts/jira_writeback.sh b/devops/scripts/jira_writeback.sh new file mode 100755 index 00000000..896ee2a2 --- /dev/null +++ b/devops/scripts/jira_writeback.sh @@ -0,0 +1,144 @@ +create_issue() { + local title="$1" + local project_key="$2" + local issue_type="$3" + local parent_issue_key="$4" + + AUTH=$(echo -ne "$JIRA_USERNAME:$JIRA_API_KEY" | base64 --wrap 0) + + local parent_issue=$(curl -s -H "Authorization: Basic $AUTH" \ + "$JIRA_SERVER/rest/api/3/issue/$parent_issue_key") + + local parent_fix_versions=$(echo $parent_issue | jq -r '.fields.fixVersions') + + local created_issue=$(curl -X POST -H "Content-Type: application/json" \ + -H "Authorization: Basic $AUTH" \ + -d '{ + "fields": { + "summary": "'"$title"'", + "project": { + "key": "'"$project_key"'" + }, + "issuetype": { + "name": "'"$issue_type"'" + }, + "parent": { + "key": "'"$parent_issue_key"'" + }, + "fixVersions": '"$parent_fix_versions"' + } + }' \ + "$JIRA_SERVER/rest/api/3/issue") + + local created_issue_id=$(echo $created_issue | jq -r '.id') + + curl -X PUT -H "Content-Type: application/json" \ + -H "Authorization: Basic $AUTH" \ + -d '{ + "fields": { + "fixVersions": '"$parent_fix_versions"' + } + }' \ + "$JIRA_SERVER/rest/api/3/issue/$created_issue_id" +} + +extract_uuid() { + local url="$1" + local uuid_regex='[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}' + if [[ "$url" =~ $uuid_regex ]]; then + echo "${BASH_REMATCH}" + else + echo "No UUID found in the URL." + fi +} + +update_issue_status() { + local issue_key="$1" + local status_name="$2" + + AUTH=$(echo -ne "$JIRA_USERNAME:$JIRA_API_KEY" | base64 --wrap 0) + + local transitions=$(curl -s -H "Authorization: Basic $AUTH" \ + "$JIRA_SERVER/rest/api/3/issue/$issue_key/transitions") + + local transition_id=$(echo "$transitions" | jq -r --arg status_name "$status_name" ' + .transitions[] | select(.isAvailable == true and .to.name == $status_name) | .id + ') + + if [ -z "$transition_id" ]; then + echo "BadRequestError" + exit 1 + else + curl -X POST -H "Content-Type: application/json" \ + -H "Authorization: Basic $AUTH" \ + -d '{ + "transition": { + "id": "'"$transition_id"'" + } + }' \ + "$JIRA_SERVER/rest/api/3/issue/$issue_key/transitions" + fi +} + +add_attachments() { + AUTH=$(echo -ne "$JIRA_USERNAME:$JIRA_API_KEY" | base64 --wrap 0) + + local issue_key="$1" + shift + local attachments=("$@") + + echo $issue_key + echo $attachments + + local form_data="" + for attachment in "${attachments[@]}"; do + form_data+="--form file=@$attachment " + done + + echo $form_data + + echo $(curl -X POST $form_data \ + -H "X-Atlassian-Token: no-check" \ + -H "Authorization: Basic $AUTH" \ + "$JIRA_SERVER/rest/api/3/issue/$issue_key/attachments") +} + +add_comment() { + AUTH=$(echo -ne "$JIRA_USERNAME:$JIRA_API_KEY" | base64 --wrap 0) + local issue_key="$1" + shift + local comment_items_input=("$@") + local comment_json="[]" + + for item in "${comment_items_input[@]}"; do + if [ -e "$item" ]; then + # If it's a file path + local attachment=$(add_attachments "$issue_key" "$item") + local id=$(echo $attachment | grep -oP '"id":\s*"\K[^"]+') + + local attachment_content=$(curl -s -I -L -H "Authorization: Basic $AUTH" "$JIRA_SERVER/rest/api/3/attachment/content/$id" \ + | grep -i "Location:" | tail -1 | awk '{print $2}' | tr -d '\r') + echo "$JIRA_SERVER/rest/api/3/attachment/content/$id" + echo "$attachment_content" + + local uuid=$(extract_uuid "$attachment_content") + echo "$uuid" + + json_object=$(jq -n --arg uuid "$uuid" '{ type: "mediaSingle", attrs: { layout: "align-start" }, content: [{ type: "media", attrs: { type: "file", id: $uuid, width: 200, height: 200, collection: "", alt: "" } }]}') + + comment_json=$(echo "$comment_json" | jq --argjson obj "$json_object" '. += [$obj]') + else + # If it's a string + json_object=$(jq -n --arg text "$item" '{ type: "paragraph", content: [{ type: "text", text: $text }]}') + + comment_json=$(echo "$comment_json" | jq --argjson obj "$json_object" '. += [$obj]') + fi + done + + request=$(jq -n --argjson content "$comment_json" '{body: { type: "doc", version: 1, content: $content }}') + + curl -X POST -H "Content-Type: application/json" \ + -H "Authorization: Basic $AUTH" \ + -d "$request" \ + "$JIRA_SERVER/rest/api/3/issue/$issue_key/comment" +} \ No newline at end of file From 35ee6789a7f6b5cd065d6ffc420130717ecc4ec6 Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 10:10:56 -0500 Subject: [PATCH 02/58] Attempt #2 --- azure-pipelines-automated-testing.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 31b34b58..473b745e 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -41,15 +41,16 @@ variables: stages: # PR's - ${{ if or(eq(variables['Build.Reason'], 'PullRequest'), eq(1,1)) }}: # TODO: Temporarily changed to always be true, change back - - stage: TestPr - displayName: Run Tests For PullRequest - jobs: - - template: templates/digital/vue-jest-run-unit-tests.yml@AzureDevOps - parameters: - nodeContainer: node - npmLocation: $(Build.SourcesDirectory) - testResultsFile: junit.xml - summaryFileLocation: $(Build.SourcesDirectory)/coverage/cobertura-coverage.xml + # TODO: Temporarily commented out + # - stage: TestPr + # displayName: Run Tests For PullRequest + # jobs: + # - template: templates/digital/vue-jest-run-unit-tests.yml@AzureDevOps + # parameters: + # nodeContainer: node + # npmLocation: $(Build.SourcesDirectory) + # testResultsFile: junit.xml + # summaryFileLocation: $(Build.SourcesDirectory)/coverage/cobertura-coverage.xml - job: playwright_tests continueOnError: true strategy: @@ -148,7 +149,7 @@ stages: env: PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" - script: | - $(System.DefaultWorkingDirectory)/jira_writeback.sh + $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment() $(Build.SourceBranchName) "AUTOMATED TEST RUN: $(date)" $(System.DefaultWorkingDirectory)/ortoni-report/index.html displayName: publish_results_to_jira env: From 464ac967630982243eb8acd715b298c8cebd8a8b Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 10:11:57 -0500 Subject: [PATCH 03/58] Attempt #3 --- azure-pipelines-automated-testing.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 473b745e..5ed9625e 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -42,9 +42,9 @@ stages: # PR's - ${{ if or(eq(variables['Build.Reason'], 'PullRequest'), eq(1,1)) }}: # TODO: Temporarily changed to always be true, change back # TODO: Temporarily commented out - # - stage: TestPr - # displayName: Run Tests For PullRequest - # jobs: + - stage: TestPr + displayName: Run Tests For PullRequest + jobs: # - template: templates/digital/vue-jest-run-unit-tests.yml@AzureDevOps # parameters: # nodeContainer: node From 0112d49d1258f06a737c576e73faa3d826ffe47c Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 10:25:21 -0500 Subject: [PATCH 04/58] Attempt #4 --- azure-pipelines-automated-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 5ed9625e..811168bb 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -150,7 +150,7 @@ stages: PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" - script: | $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh - add_comment() $(Build.SourceBranchName) "AUTOMATED TEST RUN: $(date)" $(System.DefaultWorkingDirectory)/ortoni-report/index.html + add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html" displayName: publish_results_to_jira env: JIRA_API_KEY: $(JIRA_API_KEY) From f8ea8106d2d141e0c7541e0228959b550f15b69b Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 10:35:08 -0500 Subject: [PATCH 05/58] Attempt #5 --- azure-pipelines-automated-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 811168bb..408a5304 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -149,7 +149,7 @@ stages: env: PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" - script: | - $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh + . $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html" displayName: publish_results_to_jira env: From 22454de11e7ea351d8a9b4b968dbedff289ea07b Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 10:57:35 -0500 Subject: [PATCH 06/58] Attempt #6 --- azure-pipelines-automated-testing.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 408a5304..ce0cc8ab 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -149,6 +149,7 @@ stages: env: PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" - script: | + apt-get install -y jq . $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html" displayName: publish_results_to_jira From 1a38f1dc7d15f7fd5a0c9840e838dc837305c797 Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 11:29:16 -0500 Subject: [PATCH 07/58] Attempt #7 --- azure-pipelines-automated-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index ce0cc8ab..fe67704e 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -149,7 +149,7 @@ stages: env: PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" - script: | - apt-get install -y jq + sudo apt-get install -y jq . $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html" displayName: publish_results_to_jira From fa9920a56abc159d6a93dd187b78ed5331e18ddf Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 12:00:56 -0500 Subject: [PATCH 08/58] Moved docker build to its own job --- azure-pipelines-automated-testing.yml | 42 ++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index fe67704e..527ce7dd 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -51,7 +51,27 @@ stages: # npmLocation: $(Build.SourcesDirectory) # testResultsFile: junit.xml # summaryFileLocation: $(Build.SourcesDirectory)/coverage/cobertura-coverage.xml + - job: build_docker_image + steps: + - task: Docker@2 + displayName: 'Build Docker Image' + inputs: + command: build + dockerfile: Dockerfile.playwright + repository: $(dockerImageName) + tags: $(imageTag) + arguments: '--no-cache --pull' + - script: | + docker save -o docker_build.tar $(dockerImageName):$(imageTag) + - task: PublishPipelineArtifact@1 + displayName: 'Publish Docker Image' + condition: always() + inputs: + targetPath: '$(System.DefaultWorkingDirectory)/docker_build.tar' + artifact: 'docker_build' + publishLocation: 'pipeline' - job: playwright_tests + dependsOn: build_docker_image continueOnError: true strategy: matrix: @@ -65,14 +85,21 @@ stages: shardNumber: 4 steps: - - task: Docker@2 - displayName: 'Build Docker Image' + - task: DownloadPipelineArtifact@2 inputs: - command: build - dockerfile: Dockerfile.playwright - repository: $(dockerImageName) - tags: $(imageTag) - arguments: '--no-cache --pull' + targetPath: '$(System.DefaultWorkingDirectory)/docker_build' + displayName: Download docker image + - script: | + ls + for dir in $(System.DefaultWorkingDirectory)/docker_build/*/; do + if [ -d "$dir" ]; then + mv "$dir"* $(System.DefaultWorkingDirectory)/docker_build/ + rmdir "$dir" + fi + done + docker load -i $(System.DefaultWorkingDirectory)/docker_build/docker_build.tar + ls + displayName: Load docker image - script: | # Create container and run tests @@ -149,7 +176,6 @@ stages: env: PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" - script: | - sudo apt-get install -y jq . $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html" displayName: publish_results_to_jira From 895055124d219f2ccf91fbe2bc0862b53390d001 Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 12:01:05 -0500 Subject: [PATCH 09/58] Update to docker file --- Dockerfile.playwright | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile.playwright b/Dockerfile.playwright index 6271a937..939f3dac 100644 --- a/Dockerfile.playwright +++ b/Dockerfile.playwright @@ -14,8 +14,8 @@ RUN npm install # Install Playwright browsers RUN npx playwright install --with-deps +# Install jq +RUN apt-get install -y jq + # Copy the rest of the application code COPY . . - -# Run Playwright tests -CMD ["npx", "playwright", "test"] From d303a9dd3de4c9ea5045a7f0e8392e82ae655ed1 Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 12:14:09 -0500 Subject: [PATCH 10/58] Attempt #8 --- azure-pipelines-automated-testing.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 527ce7dd..1e4f1f4d 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -62,7 +62,8 @@ stages: tags: $(imageTag) arguments: '--no-cache --pull' - script: | - docker save -o docker_build.tar $(dockerImageName):$(imageTag) + docker save -o docker_build.tar $(dockerImageName):$(imageTag) 2?&1 | tee error.log + displayName: Save docker image as tar - task: PublishPipelineArtifact@1 displayName: 'Publish Docker Image' condition: always() From c8f814948b2d7481fde1828da1b265fca1194a8b Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 12:20:54 -0500 Subject: [PATCH 11/58] Attempt #9 --- azure-pipelines-automated-testing.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 1e4f1f4d..4bed5b44 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -53,16 +53,9 @@ stages: # summaryFileLocation: $(Build.SourcesDirectory)/coverage/cobertura-coverage.xml - job: build_docker_image steps: - - task: Docker@2 - displayName: 'Build Docker Image' - inputs: - command: build - dockerfile: Dockerfile.playwright - repository: $(dockerImageName) - tags: $(imageTag) - arguments: '--no-cache --pull' - script: | - docker save -o docker_build.tar $(dockerImageName):$(imageTag) 2?&1 | tee error.log + docker build -t $(dockerImageName):$(imageTag) . --no-cache --pull + docker save -o docker_build.tar ./$(dockerImageName):$(imageTag) displayName: Save docker image as tar - task: PublishPipelineArtifact@1 displayName: 'Publish Docker Image' From 800b26b6b408683e5b63209518af8db451ecf982 Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 12:22:38 -0500 Subject: [PATCH 12/58] Attempt #10 --- azure-pipelines-automated-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 4bed5b44..234c0d83 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -55,7 +55,7 @@ stages: steps: - script: | docker build -t $(dockerImageName):$(imageTag) . --no-cache --pull - docker save -o docker_build.tar ./$(dockerImageName):$(imageTag) + docker save -o docker_build.tar $(dockerImageName):$(imageTag) displayName: Save docker image as tar - task: PublishPipelineArtifact@1 displayName: 'Publish Docker Image' From 7f04af2a664a13f748d2b3e332205e3e8f60e465 Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 12:24:36 -0500 Subject: [PATCH 13/58] Attempt #11 --- azure-pipelines-automated-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 234c0d83..fedfc344 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -54,7 +54,7 @@ stages: - job: build_docker_image steps: - script: | - docker build -t $(dockerImageName):$(imageTag) . --no-cache --pull + docker build -f Dockerfile.playwright -t $(dockerImageName):$(imageTag) . --no-cache --pull docker save -o docker_build.tar $(dockerImageName):$(imageTag) displayName: Save docker image as tar - task: PublishPipelineArtifact@1 From d464a0457379c440971bc33f8221cc789a4813e3 Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 12:42:08 -0500 Subject: [PATCH 14/58] Attempt #11 --- azure-pipelines-automated-testing.yml | 28 ++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index fedfc344..e54b9efb 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -149,10 +149,23 @@ stages: condition: always() - job: download_and_merge_reports - container: - image: mcr.microsoft.com/playwright:v1.48.0-noble dependsOn: playwright_tests steps: + - task: DownloadPipelineArtifact@2 + inputs: + targetPath: '$(System.DefaultWorkingDirectory)/docker_build' + displayName: Download docker image + - script: | + ls + for dir in $(System.DefaultWorkingDirectory)/docker_build/*/; do + if [ -d "$dir" ]; then + mv "$dir"* $(System.DefaultWorkingDirectory)/docker_build/ + rmdir "$dir" + fi + done + docker load -i $(System.DefaultWorkingDirectory)/docker_build/docker_build.tar + ls + displayName: Load docker image - task: DownloadPipelineArtifact@2 inputs: targetPath: '$(System.DefaultWorkingDirectory)/playwright-reports' @@ -170,7 +183,16 @@ stages: env: PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" - script: | - . $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh + # Create container for jira writeback + container_id=$(docker create \ + --ipc=host \ + -e JIRA_SERVER=$(JIRA_SERVER) \ + -e JIRA_USERNAME=$(JIRA_USERNAME) \ + -e JIRA_API_KEY=$(JIRA_API_KEY) \ + -e CI=true \ + -e NODE_ENV=$(NODE_ENV) \ + $(dockerImageName):$(imageTag) \ + . $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html" displayName: publish_results_to_jira env: From 0763bc7601b78d670b829f27b07da37629821e03 Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 12:44:08 -0500 Subject: [PATCH 15/58] Attempt #12 --- azure-pipelines-automated-testing.yml | 48 +++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index e54b9efb..ea4e6a91 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -166,10 +166,10 @@ stages: docker load -i $(System.DefaultWorkingDirectory)/docker_build/docker_build.tar ls displayName: Load docker image - - task: DownloadPipelineArtifact@2 + - task: DownloadPipelineArtifact@2 inputs: targetPath: '$(System.DefaultWorkingDirectory)/playwright-reports' - - script: | + - script: | npm i ortoni-report && for dir in $(System.DefaultWorkingDirectory)/playwright-reports/*/; do if [ -d "$dir" ]; then @@ -179,21 +179,21 @@ stages: done npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports ls - displayName: merge_reports - env: - PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" - - script: | - # Create container for jira writeback - container_id=$(docker create \ - --ipc=host \ - -e JIRA_SERVER=$(JIRA_SERVER) \ - -e JIRA_USERNAME=$(JIRA_USERNAME) \ - -e JIRA_API_KEY=$(JIRA_API_KEY) \ - -e CI=true \ - -e NODE_ENV=$(NODE_ENV) \ - $(dockerImageName):$(imageTag) \ - . $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && - add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html" + displayName: merge_reports + env: + PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" + - script: | + # Create container for jira writeback + container_id=$(docker create \ + --ipc=host \ + -e JIRA_SERVER=$(JIRA_SERVER) \ + -e JIRA_USERNAME=$(JIRA_USERNAME) \ + -e JIRA_API_KEY=$(JIRA_API_KEY) \ + -e CI=true \ + -e NODE_ENV=$(NODE_ENV) \ + $(dockerImageName):$(imageTag) \ + . $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && + add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html" displayName: publish_results_to_jira env: JIRA_API_KEY: $(JIRA_API_KEY) @@ -210,13 +210,13 @@ stages: # testRunTitle: 'Playwright Tests' # condition: succeededOrFailed() - - task: PublishPipelineArtifact@1 - displayName: 'Publish Merged Report' - condition: always() - inputs: - targetPath: '$(System.DefaultWorkingDirectory)/ortoni-report' - artifact: 'playwright-merged-report' - publishLocation: 'pipeline' + - task: PublishPipelineArtifact@1 + displayName: 'Publish Merged Report' + condition: always() + inputs: + targetPath: '$(System.DefaultWorkingDirectory)/ortoni-report' + artifact: 'playwright-merged-report' + publishLocation: 'pipeline' - ${{ else }}: # Dev Build/Deploy From 16e883185b7b7ef24e04307a8a16dbb1ca034ccc Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 12:44:45 -0500 Subject: [PATCH 16/58] Attempt #13 --- azure-pipelines-automated-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index ea4e6a91..99bb0667 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -167,8 +167,8 @@ stages: ls displayName: Load docker image - task: DownloadPipelineArtifact@2 - inputs: - targetPath: '$(System.DefaultWorkingDirectory)/playwright-reports' + inputs: + targetPath: '$(System.DefaultWorkingDirectory)/playwright-reports' - script: | npm i ortoni-report && for dir in $(System.DefaultWorkingDirectory)/playwright-reports/*/; do From 55e4211fe16c908ae6e41818729a9e2189a49a65 Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 14:09:00 -0500 Subject: [PATCH 17/58] Attempt #14 --- azure-pipelines-automated-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 99bb0667..a7d4255c 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -193,7 +193,7 @@ stages: -e NODE_ENV=$(NODE_ENV) \ $(dockerImageName):$(imageTag) \ . $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && - add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html" + add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") displayName: publish_results_to_jira env: JIRA_API_KEY: $(JIRA_API_KEY) From 185e17a534e529bcfde667c76cec16d49b417ff8 Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 15:13:12 -0500 Subject: [PATCH 18/58] Attempt #15 --- azure-pipelines-automated-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index a7d4255c..680cf954 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -194,7 +194,7 @@ stages: $(dockerImageName):$(imageTag) \ . $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") - displayName: publish_results_to_jira + displayName: publish_results_to_jira env: JIRA_API_KEY: $(JIRA_API_KEY) From 95508623a4c4bb50c9bb2bde34b5f8f15d6c1848 Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 19 Feb 2025 15:13:44 -0500 Subject: [PATCH 19/58] Attempt #16 --- azure-pipelines-automated-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 680cf954..2fc8111d 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -195,8 +195,8 @@ stages: . $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") displayName: publish_results_to_jira - env: - JIRA_API_KEY: $(JIRA_API_KEY) + env: + JIRA_API_KEY: $(JIRA_API_KEY) # TODO: Enable later when working on PR gate # - task: PublishTestResults@2 From cf2281e83814eb9778826b0b3ad3b52472714908 Mon Sep 17 00:00:00 2001 From: Chase King Date: Thu, 20 Feb 2025 15:17:40 -0500 Subject: [PATCH 20/58] Attempt #17 --- azure-pipelines-automated-testing.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 2fc8111d..a64f507c 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -112,7 +112,6 @@ stages: "npx wait-on http://localhost:8080 && npm run test:playwright -- --shard=$(shardNumber)/$(totalShards) --reporter=list,blob --grep \"@smoke | @Advanced\"") # Start container and stream logs - echo "Starting tests for shard $(shardNumber)..." docker start -a $container_id @@ -189,8 +188,6 @@ stages: -e JIRA_SERVER=$(JIRA_SERVER) \ -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ - -e CI=true \ - -e NODE_ENV=$(NODE_ENV) \ $(dockerImageName):$(imageTag) \ . $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") From 63aa0421d071361de74c7a3dcf65d516b3574a7c Mon Sep 17 00:00:00 2001 From: Chase King Date: Fri, 21 Feb 2025 10:22:01 -0500 Subject: [PATCH 21/58] Attempt #18 --- azure-pipelines-automated-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index a64f507c..0dae2029 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -189,7 +189,7 @@ stages: -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ - . $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && + source $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") displayName: publish_results_to_jira env: From 8635a5f1cf173d98585c3eac4e8777e07a8205f5 Mon Sep 17 00:00:00 2001 From: Chase King Date: Fri, 21 Feb 2025 10:56:15 -0500 Subject: [PATCH 22/58] Moved docker build inside other steps to reduce runtime --- azure-pipelines-automated-testing.yml | 57 +++++++-------------------- 1 file changed, 15 insertions(+), 42 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 0dae2029..ebab438e 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -51,19 +51,6 @@ stages: # npmLocation: $(Build.SourcesDirectory) # testResultsFile: junit.xml # summaryFileLocation: $(Build.SourcesDirectory)/coverage/cobertura-coverage.xml - - job: build_docker_image - steps: - - script: | - docker build -f Dockerfile.playwright -t $(dockerImageName):$(imageTag) . --no-cache --pull - docker save -o docker_build.tar $(dockerImageName):$(imageTag) - displayName: Save docker image as tar - - task: PublishPipelineArtifact@1 - displayName: 'Publish Docker Image' - condition: always() - inputs: - targetPath: '$(System.DefaultWorkingDirectory)/docker_build.tar' - artifact: 'docker_build' - publishLocation: 'pipeline' - job: playwright_tests dependsOn: build_docker_image continueOnError: true @@ -79,21 +66,14 @@ stages: shardNumber: 4 steps: - - task: DownloadPipelineArtifact@2 + - task: Docker@2 + displayName: 'Build Docker Image' inputs: - targetPath: '$(System.DefaultWorkingDirectory)/docker_build' - displayName: Download docker image - - script: | - ls - for dir in $(System.DefaultWorkingDirectory)/docker_build/*/; do - if [ -d "$dir" ]; then - mv "$dir"* $(System.DefaultWorkingDirectory)/docker_build/ - rmdir "$dir" - fi - done - docker load -i $(System.DefaultWorkingDirectory)/docker_build/docker_build.tar - ls - displayName: Load docker image + command: build + dockerfile: Dockerfile.playwright + repository: $(dockerImageName) + tags: $(imageTag) + arguments: '--no-cache --pull' - script: | # Create container and run tests @@ -150,26 +130,18 @@ stages: - job: download_and_merge_reports dependsOn: playwright_tests steps: - - task: DownloadPipelineArtifact@2 + - task: Docker@2 + displayName: 'Build Docker Image' inputs: - targetPath: '$(System.DefaultWorkingDirectory)/docker_build' - displayName: Download docker image - - script: | - ls - for dir in $(System.DefaultWorkingDirectory)/docker_build/*/; do - if [ -d "$dir" ]; then - mv "$dir"* $(System.DefaultWorkingDirectory)/docker_build/ - rmdir "$dir" - fi - done - docker load -i $(System.DefaultWorkingDirectory)/docker_build/docker_build.tar - ls - displayName: Load docker image + command: build + dockerfile: Dockerfile.playwright + repository: $(dockerImageName) + tags: $(imageTag) + arguments: '--no-cache --pull' - task: DownloadPipelineArtifact@2 inputs: targetPath: '$(System.DefaultWorkingDirectory)/playwright-reports' - script: | - npm i ortoni-report && for dir in $(System.DefaultWorkingDirectory)/playwright-reports/*/; do if [ -d "$dir" ]; then mv "$dir"* $(System.DefaultWorkingDirectory)/playwright-reports/ @@ -192,6 +164,7 @@ stages: source $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") displayName: publish_results_to_jira + shell: bash env: JIRA_API_KEY: $(JIRA_API_KEY) From 4efd3c15f11547d535ddc2bd52fc33750898065c Mon Sep 17 00:00:00 2001 From: Chase King Date: Fri, 21 Feb 2025 11:01:08 -0500 Subject: [PATCH 23/58] Attempt #19 --- azure-pipelines-automated-testing.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index ebab438e..b2667ee1 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -153,6 +153,24 @@ stages: displayName: merge_reports env: PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" + - task: Bash@3 + inputs: + targetType: 'inline' + script: | + # Create container for jira writeback + container_id=$(docker create \ + --ipc=host \ + -e JIRA_SERVER=$(JIRA_SERVER) \ + -e JIRA_USERNAME=$(JIRA_USERNAME) \ + -e JIRA_API_KEY=$(JIRA_API_KEY) \ + $(dockerImageName):$(imageTag) \ + source $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && + add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") + env: + JIRA_API_KEY: $(JIRA_API_KEY) + displayName: publish_results_to_jira + + echo 'Hello world' - script: | # Create container for jira writeback container_id=$(docker create \ @@ -163,10 +181,7 @@ stages: $(dockerImageName):$(imageTag) \ source $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") - displayName: publish_results_to_jira - shell: bash - env: - JIRA_API_KEY: $(JIRA_API_KEY) + # TODO: Enable later when working on PR gate # - task: PublishTestResults@2 From c45be77c1c2b4fc81ca5e70adeba5281119ef7b3 Mon Sep 17 00:00:00 2001 From: Chase King Date: Fri, 21 Feb 2025 11:02:02 -0500 Subject: [PATCH 24/58] Removed unused code --- azure-pipelines-automated-testing.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index b2667ee1..52827211 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -169,19 +169,6 @@ stages: env: JIRA_API_KEY: $(JIRA_API_KEY) displayName: publish_results_to_jira - - echo 'Hello world' - - script: | - # Create container for jira writeback - container_id=$(docker create \ - --ipc=host \ - -e JIRA_SERVER=$(JIRA_SERVER) \ - -e JIRA_USERNAME=$(JIRA_USERNAME) \ - -e JIRA_API_KEY=$(JIRA_API_KEY) \ - $(dockerImageName):$(imageTag) \ - source $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && - add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") - # TODO: Enable later when working on PR gate # - task: PublishTestResults@2 From f64a603934fe99303e19b5e0ff1c932dd30cc007 Mon Sep 17 00:00:00 2001 From: Chase King Date: Fri, 21 Feb 2025 14:53:02 -0500 Subject: [PATCH 25/58] Removed dependency --- azure-pipelines-automated-testing.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 52827211..8aa9555f 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -52,7 +52,6 @@ stages: # testResultsFile: junit.xml # summaryFileLocation: $(Build.SourcesDirectory)/coverage/cobertura-coverage.xml - job: playwright_tests - dependsOn: build_docker_image continueOnError: true strategy: matrix: From 24fb5c3842767fca426de4146cc5021d85fec81e Mon Sep 17 00:00:00 2001 From: Chase King Date: Mon, 24 Feb 2025 09:27:45 -0500 Subject: [PATCH 26/58] Added bash annotation to script --- devops/scripts/jira_writeback.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/devops/scripts/jira_writeback.sh b/devops/scripts/jira_writeback.sh index 896ee2a2..95b23a0a 100755 --- a/devops/scripts/jira_writeback.sh +++ b/devops/scripts/jira_writeback.sh @@ -1,3 +1,4 @@ +#!/bin/bash create_issue() { local title="$1" local project_key="$2" From 35653ebd9948f5826dbcf8d7b215f2fbbfdb4543 Mon Sep 17 00:00:00 2001 From: Chase King Date: Mon, 24 Feb 2025 09:27:55 -0500 Subject: [PATCH 27/58] Attempt #20 --- azure-pipelines-automated-testing.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 8aa9555f..0edc6ad3 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -152,10 +152,7 @@ stages: displayName: merge_reports env: PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" - - task: Bash@3 - inputs: - targetType: 'inline' - script: | + - bash: | # Create container for jira writeback container_id=$(docker create \ --ipc=host \ From 8ead06e3a463c287fea857015fe86c0d7b6416ec Mon Sep 17 00:00:00 2001 From: Chase King Date: Mon, 24 Feb 2025 09:44:51 -0500 Subject: [PATCH 28/58] Specified to only install chromium for playwright --- Dockerfile.playwright | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.playwright b/Dockerfile.playwright index 939f3dac..a064c31e 100644 --- a/Dockerfile.playwright +++ b/Dockerfile.playwright @@ -12,7 +12,7 @@ COPY package*.json ./ RUN npm install # Install Playwright browsers -RUN npx playwright install --with-deps +RUN npx playwright install chromium --with-deps # Install jq RUN apt-get install -y jq From 0b0a8d6d0722a5f1f744eb8cd51a6e623e374547 Mon Sep 17 00:00:00 2001 From: Chase King Date: Mon, 24 Feb 2025 09:45:10 -0500 Subject: [PATCH 29/58] Attempt #21 --- azure-pipelines-automated-testing.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 0edc6ad3..5fa6792a 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -160,8 +160,7 @@ stages: -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ - source $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && - add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") + $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") env: JIRA_API_KEY: $(JIRA_API_KEY) displayName: publish_results_to_jira From 49f7dddb5f2df886f34a4172ed669bf4e6c17cb6 Mon Sep 17 00:00:00 2001 From: Chase King Date: Mon, 24 Feb 2025 10:09:04 -0500 Subject: [PATCH 30/58] Attempt #22 --- devops/scripts/jira_writeback.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/devops/scripts/jira_writeback.sh b/devops/scripts/jira_writeback.sh index 95b23a0a..1d605072 100755 --- a/devops/scripts/jira_writeback.sh +++ b/devops/scripts/jira_writeback.sh @@ -142,4 +142,8 @@ add_comment() { -H "Authorization: Basic $AUTH" \ -d "$request" \ "$JIRA_SERVER/rest/api/3/issue/$issue_key/comment" -} \ No newline at end of file +} + +if [[ $# -gt 0 ]]; then # IF function call passed in + "$@" # Call function +fi \ No newline at end of file From 46984b1aa5471cc308f2aca2034d96dd1840e1a6 Mon Sep 17 00:00:00 2001 From: Chase King Date: Mon, 24 Feb 2025 11:10:48 -0500 Subject: [PATCH 31/58] Attempt #23 --- azure-pipelines-automated-testing.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 5fa6792a..306b818a 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -147,7 +147,7 @@ stages: rmdir "$dir" fi done - npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports + npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/ortoni-report ls displayName: merge_reports env: @@ -160,6 +160,7 @@ stages: -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ + chmod +x $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") env: JIRA_API_KEY: $(JIRA_API_KEY) From 298ede9950d87bf8eb083b53dc03e4178c710c15 Mon Sep 17 00:00:00 2001 From: Chase King Date: Tue, 25 Feb 2025 09:14:45 -0500 Subject: [PATCH 32/58] Fixed path to reports --- azure-pipelines-automated-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 306b818a..31de05c6 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -147,7 +147,7 @@ stages: rmdir "$dir" fi done - npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/ortoni-report + npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports ls displayName: merge_reports env: From b23cc69da1065de71d4f50922222038736534bc3 Mon Sep 17 00:00:00 2001 From: Chase King Date: Tue, 25 Feb 2025 09:32:07 -0500 Subject: [PATCH 33/58] Changed position of commands --- azure-pipelines-automated-testing.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 31de05c6..64168191 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -147,11 +147,8 @@ stages: rmdir "$dir" fi done - npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports ls - displayName: merge_reports - env: - PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" + displayName: move_reports - bash: | # Create container for jira writeback container_id=$(docker create \ @@ -160,11 +157,13 @@ stages: -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ + npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports && chmod +x $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") env: JIRA_API_KEY: $(JIRA_API_KEY) - displayName: publish_results_to_jira + PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" + displayName: merge_and_publish_results_to_jira # TODO: Enable later when working on PR gate # - task: PublishTestResults@2 From 1aaaa205ea2067516b3688dde5f8dcd7cbab2891 Mon Sep 17 00:00:00 2001 From: Chase King Date: Tue, 25 Feb 2025 09:47:45 -0500 Subject: [PATCH 34/58] Upgraded to node 20 --- Dockerfile.playwright | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.playwright b/Dockerfile.playwright index a064c31e..46a2114a 100644 --- a/Dockerfile.playwright +++ b/Dockerfile.playwright @@ -1,4 +1,4 @@ -FROM node:16 +FROM node:20 FROM mcr.microsoft.com/playwright:v1.48.0-noble From 6dd1a4e6c0740f634186c4eb507b062657c6febc Mon Sep 17 00:00:00 2001 From: Chase King Date: Tue, 25 Feb 2025 09:48:54 -0500 Subject: [PATCH 35/58] Attempt #24 --- azure-pipelines-automated-testing.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 64168191..6197bb8e 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -158,6 +158,7 @@ stages: -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports && + ls && # TODO: Debug. Remove later chmod +x $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") env: From e6e479cbd21f3512f78c2df5eb26bef164681207 Mon Sep 17 00:00:00 2001 From: Chase King Date: Tue, 25 Feb 2025 13:56:33 -0500 Subject: [PATCH 36/58] Attempt #25 --- azure-pipelines-automated-testing.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 6197bb8e..b913f15f 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -157,9 +157,9 @@ stages: -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ - npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports && - ls && # TODO: Debug. Remove later - chmod +x $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && + npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports; + ls; # TODO: Debug. Remove later + chmod +x $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh; $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") env: JIRA_API_KEY: $(JIRA_API_KEY) From d124fe8a81a87ea3d8bedc6ada6ffb909561b910 Mon Sep 17 00:00:00 2001 From: Chase King Date: Tue, 25 Feb 2025 14:08:45 -0500 Subject: [PATCH 37/58] Attempt #26 --- azure-pipelines-automated-testing.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index b913f15f..ae989a2d 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -161,6 +161,14 @@ stages: ls; # TODO: Debug. Remove later chmod +x $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh; $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") + + # Start container and stream logs + echo "Starting merge" + docker start -a $container_id + + # Remove container + echo "Cleaning up container..." + docker rm $container_id env: JIRA_API_KEY: $(JIRA_API_KEY) PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" From 19c180a55cc2f26a79ac398530ec4ab62c9f0351 Mon Sep 17 00:00:00 2001 From: Chase King Date: Tue, 25 Feb 2025 14:17:42 -0500 Subject: [PATCH 38/58] Added removal step --- azure-pipelines-automated-testing.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index ae989a2d..f7494d9c 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -169,6 +169,9 @@ stages: # Remove container echo "Cleaning up container..." docker rm $container_id + + # TODO: REMOVE Delete all playwright containers + docker rmi $(docker images | grep "playwright-tests") env: JIRA_API_KEY: $(JIRA_API_KEY) PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" @@ -193,6 +196,10 @@ stages: targetPath: '$(System.DefaultWorkingDirectory)/ortoni-report' artifact: 'playwright-merged-report' publishLocation: 'pipeline' + - script: | + docker rmi $(dockerImageName):$(imageTag) -f + displayName: 'Cleanup Docker Image' + condition: always() - ${{ else }}: # Dev Build/Deploy From 2fe6c33497486972555b2c5f502a8ea32d687dd8 Mon Sep 17 00:00:00 2001 From: Chase King Date: Tue, 25 Feb 2025 14:20:51 -0500 Subject: [PATCH 39/58] Attempt #26 --- azure-pipelines-automated-testing.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index f7494d9c..072fd13c 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -157,9 +157,9 @@ stages: -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ - npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports; - ls; # TODO: Debug. Remove later - chmod +x $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh; + npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports && + ls && # TODO: Debug. Remove later + chmod +x $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") # Start container and stream logs From ff6634f31254c84eeec8cd691813b0e56e7ff15b Mon Sep 17 00:00:00 2001 From: Chase King Date: Tue, 25 Feb 2025 14:43:05 -0500 Subject: [PATCH 40/58] Attempt #27 --- azure-pipelines-automated-testing.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 072fd13c..dcb91312 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -157,11 +157,7 @@ stages: -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ - npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports && - ls && # TODO: Debug. Remove later - chmod +x $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh && - $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment "$(Build.SourceBranchName)" "AUTOMATED TEST RUN: $(date)" "$(System.DefaultWorkingDirectory)/ortoni-report/index.html") - + /bin/sh "npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports && ls && $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"$(System.DefaultWorkingDirectory)/ortoni-report/index.html\"" # Start container and stream logs echo "Starting merge" docker start -a $container_id @@ -169,9 +165,6 @@ stages: # Remove container echo "Cleaning up container..." docker rm $container_id - - # TODO: REMOVE Delete all playwright containers - docker rmi $(docker images | grep "playwright-tests") env: JIRA_API_KEY: $(JIRA_API_KEY) PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" From 04863068b14b5a68eacf03488b13afccbd30b379 Mon Sep 17 00:00:00 2001 From: Chase King Date: Tue, 25 Feb 2025 14:52:04 -0500 Subject: [PATCH 41/58] Added missing paren --- azure-pipelines-automated-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index dcb91312..6b700e16 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -157,7 +157,7 @@ stages: -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ - /bin/sh "npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports && ls && $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"$(System.DefaultWorkingDirectory)/ortoni-report/index.html\"" + /bin/sh "npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports && ls && $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"$(System.DefaultWorkingDirectory)/ortoni-report/index.html\"") # Start container and stream logs echo "Starting merge" docker start -a $container_id From 036d351a947c89bdf5968a0cbb6c469c2ddf7742 Mon Sep 17 00:00:00 2001 From: Chase King Date: Tue, 25 Feb 2025 15:02:46 -0500 Subject: [PATCH 42/58] Attempt #28 --- azure-pipelines-automated-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 6b700e16..6830898e 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -157,7 +157,7 @@ stages: -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ - /bin/sh "npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports && ls && $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"$(System.DefaultWorkingDirectory)/ortoni-report/index.html\"") + bash -c "npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports && ls && $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"$(System.DefaultWorkingDirectory)/ortoni-report/index.html\"") # Start container and stream logs echo "Starting merge" docker start -a $container_id From 739432fed022a08e04249c4c98c2994b45998471 Mon Sep 17 00:00:00 2001 From: Chase King Date: Tue, 25 Feb 2025 15:15:46 -0500 Subject: [PATCH 43/58] Attempt #29 --- azure-pipelines-automated-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 6830898e..3158222f 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -157,7 +157,7 @@ stages: -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ - bash -c "npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports && ls && $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"$(System.DefaultWorkingDirectory)/ortoni-report/index.html\"") + bash -c "pwd && ls && ls ./playwright-reports/; npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports && ls && $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"$(System.DefaultWorkingDirectory)/ortoni-report/index.html\"") # Start container and stream logs echo "Starting merge" docker start -a $container_id From de317c127fb62f902b47b6cd4244783d255d5cd2 Mon Sep 17 00:00:00 2001 From: Chase King Date: Tue, 25 Feb 2025 15:27:06 -0500 Subject: [PATCH 44/58] Moved tasks around --- azure-pipelines-automated-testing.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 3158222f..b568320c 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -129,14 +129,6 @@ stages: - job: download_and_merge_reports dependsOn: playwright_tests steps: - - task: Docker@2 - displayName: 'Build Docker Image' - inputs: - command: build - dockerfile: Dockerfile.playwright - repository: $(dockerImageName) - tags: $(imageTag) - arguments: '--no-cache --pull' - task: DownloadPipelineArtifact@2 inputs: targetPath: '$(System.DefaultWorkingDirectory)/playwright-reports' @@ -149,6 +141,14 @@ stages: done ls displayName: move_reports + - task: Docker@2 + displayName: 'Build Docker Image' + inputs: + command: build + dockerfile: Dockerfile.playwright + repository: $(dockerImageName) + tags: $(imageTag) + arguments: '--no-cache --pull' - bash: | # Create container for jira writeback container_id=$(docker create \ From 2d6dc6ec29ca6569765efe60af0022d9c95d0744 Mon Sep 17 00:00:00 2001 From: Chase King Date: Tue, 25 Feb 2025 15:39:55 -0500 Subject: [PATCH 45/58] Attempt #30 --- azure-pipelines-automated-testing.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index b568320c..0cc673c1 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -132,15 +132,15 @@ stages: - task: DownloadPipelineArtifact@2 inputs: targetPath: '$(System.DefaultWorkingDirectory)/playwright-reports' - - script: | - for dir in $(System.DefaultWorkingDirectory)/playwright-reports/*/; do - if [ -d "$dir" ]; then - mv "$dir"* $(System.DefaultWorkingDirectory)/playwright-reports/ - rmdir "$dir" - fi - done - ls - displayName: move_reports + # - script: | + # for dir in $(System.DefaultWorkingDirectory)/playwright-reports/*/; do + # if [ -d "$dir" ]; then + # mv "$dir"* $(System.DefaultWorkingDirectory)/playwright-reports/ + # rmdir "$dir" + # fi + # done + # ls + # displayName: move_reports - task: Docker@2 displayName: 'Build Docker Image' inputs: @@ -157,7 +157,12 @@ stages: -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ - bash -c "pwd && ls && ls ./playwright-reports/; npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports && ls && $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"$(System.DefaultWorkingDirectory)/ortoni-report/index.html\"") + bash -c "for dir in $(System.DefaultWorkingDirectory)/playwright-reports/*/; do + if [ -d "$dir" ]; then + mv "$dir"* $(System.DefaultWorkingDirectory)/playwright-reports/ && + rmdir "$dir" + fi + done && pwd && ls && ls ./playwright-reports/; npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports && ls && $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"$(System.DefaultWorkingDirectory)/ortoni-report/index.html\"") # Start container and stream logs echo "Starting merge" docker start -a $container_id From 8a0d78e6a6aaced3a640fb9d3c12a37a29699f28 Mon Sep 17 00:00:00 2001 From: Chase King Date: Tue, 25 Feb 2025 15:55:05 -0500 Subject: [PATCH 46/58] Attempt #31 --- azure-pipelines-automated-testing.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 0cc673c1..3ea70a6a 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -157,12 +157,12 @@ stages: -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ - bash -c "for dir in $(System.DefaultWorkingDirectory)/playwright-reports/*/; do + bash -c "for dir in ./playwright-reports/*/; do if [ -d "$dir" ]; then - mv "$dir"* $(System.DefaultWorkingDirectory)/playwright-reports/ && + mv "$dir"* ./playwright-reports/ && rmdir "$dir" fi - done && pwd && ls && ls ./playwright-reports/; npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports && ls && $(System.DefaultWorkingDirectory)/devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"$(System.DefaultWorkingDirectory)/ortoni-report/index.html\"") + done && pwd && ls && ls ./playwright-reports/; npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports && ls && ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"./ortoni-report/index.html\"") # Start container and stream logs echo "Starting merge" docker start -a $container_id From 758ab0ba8ce28ee88e87bbb09e045ff68233dc5a Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 26 Feb 2025 10:19:56 -0500 Subject: [PATCH 47/58] Attempt #32 --- azure-pipelines-automated-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 3ea70a6a..3424cc27 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -159,10 +159,10 @@ stages: $(dockerImageName):$(imageTag) \ bash -c "for dir in ./playwright-reports/*/; do if [ -d "$dir" ]; then - mv "$dir"* ./playwright-reports/ && + mv "$dir"* . && rmdir "$dir" fi - done && pwd && ls && ls ./playwright-reports/; npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports && ls && ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"./ortoni-report/index.html\"") + done; pwd && ls && ls ./playwright-reports/; npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports && ls && ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"./ortoni-report/index.html\"") # Start container and stream logs echo "Starting merge" docker start -a $container_id From 81eedbd61ed95ed09f8f04bfd1ae6d98fc84fce2 Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 26 Feb 2025 10:43:42 -0500 Subject: [PATCH 48/58] Attempt #33 --- azure-pipelines-automated-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 3424cc27..f6536d42 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -157,9 +157,9 @@ stages: -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ - bash -c "for dir in ./playwright-reports/*/; do + bash -c "for dir in /app/playwright-reports/*/; do if [ -d "$dir" ]; then - mv "$dir"* . && + mv "$dir"* /app/playwright-reports && rmdir "$dir" fi done; pwd && ls && ls ./playwright-reports/; npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports && ls && ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"./ortoni-report/index.html\"") From d3ab5004304f4c248dcf7aa6768f31f6559b94e4 Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 26 Feb 2025 11:22:22 -0500 Subject: [PATCH 49/58] Attempt #34 --- azure-pipelines-automated-testing.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index f6536d42..a8fd8ce3 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -157,12 +157,13 @@ stages: -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ - bash -c "for dir in /app/playwright-reports/*/; do + bash -c "echo \"Contents of /app/playwright-reports/:\" && ls /app/playwright-reports/ && echo \"Moving subfolders of playwright-reports...\" + for dir in /app/playwright-reports/*/; do if [ -d "$dir" ]; then mv "$dir"* /app/playwright-reports && rmdir "$dir" fi - done; pwd && ls && ls ./playwright-reports/; npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports && ls && ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"./ortoni-report/index.html\"") + done; echo \"Current directory:\" pwd && echo \"Contents of current dir: \" && ls && echo \"Contents of playwright-reports:\" && ls ./playwright-reports/; echo \"Merging reports...\" && npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports; ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"./ortoni-report/index.html\"") # Start container and stream logs echo "Starting merge" docker start -a $container_id From 839d13c22f9888af2970c2bb6b6c7a0e049f3d70 Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 26 Feb 2025 16:00:57 -0500 Subject: [PATCH 50/58] Attempt #35 --- azure-pipelines-automated-testing.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index a8fd8ce3..ef902703 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -157,13 +157,8 @@ stages: -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ - bash -c "echo \"Contents of /app/playwright-reports/:\" && ls /app/playwright-reports/ && echo \"Moving subfolders of playwright-reports...\" - for dir in /app/playwright-reports/*/; do - if [ -d "$dir" ]; then - mv "$dir"* /app/playwright-reports && - rmdir "$dir" - fi - done; echo \"Current directory:\" pwd && echo \"Contents of current dir: \" && ls && echo \"Contents of playwright-reports:\" && ls ./playwright-reports/; echo \"Merging reports...\" && npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports; ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"./ortoni-report/index.html\"") + bash -c "echo \"Contents of /app/playwright-reports/:\" && ls /app/playwright-reports/ && echo \"Moving subfolders of playwright-reports...\" && + find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \;; echo \"Current directory:\" && pwd && echo \"Contents of current dir: \" && ls && echo \"Contents of playwright-reports:\" && ls ./playwright-reports/; echo \"Merging reports...\" && npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports; ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"./ortoni-report/index.html\"") # Start container and stream logs echo "Starting merge" docker start -a $container_id From 719890969a100901c806898d6ddef9ed2a761d9e Mon Sep 17 00:00:00 2001 From: Chase King Date: Wed, 26 Feb 2025 16:18:09 -0500 Subject: [PATCH 51/58] Attempt #36 --- azure-pipelines-automated-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index ef902703..ee4e1a64 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -158,7 +158,7 @@ stages: -e JIRA_API_KEY=$(JIRA_API_KEY) \ $(dockerImageName):$(imageTag) \ bash -c "echo \"Contents of /app/playwright-reports/:\" && ls /app/playwright-reports/ && echo \"Moving subfolders of playwright-reports...\" && - find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \;; echo \"Current directory:\" && pwd && echo \"Contents of current dir: \" && ls && echo \"Contents of playwright-reports:\" && ls ./playwright-reports/; echo \"Merging reports...\" && npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports; ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"./ortoni-report/index.html\"") + find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \;; echo \"Current directory:\" && pwd && echo \"Contents of current dir: \" && ls && echo \"Contents of playwright-reports:\" && ls ./playwright-reports/; echo \"Merging reports...\" && npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports; echo \"Contents of current dir: \" && ls && echo \"Contents of playwright-reports:\" && ls && ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"./ortoni-report/index.html\"") # Start container and stream logs echo "Starting merge" docker start -a $container_id From b0fe3c7e29d526fe886b04b9eb43526032158c4c Mon Sep 17 00:00:00 2001 From: Chase King Date: Thu, 27 Feb 2025 11:29:06 -0500 Subject: [PATCH 52/58] Attempt #37 --- azure-pipelines-automated-testing.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index ee4e1a64..230355d7 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -156,13 +156,23 @@ stages: -e JIRA_SERVER=$(JIRA_SERVER) \ -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ + -e PLAYWRIGHT_JUNIT_OUTPUT_FILE=$(PLAYWRIGHT_JUNIT_OUTPUT_FILE) \ $(dockerImageName):$(imageTag) \ bash -c "echo \"Contents of /app/playwright-reports/:\" && ls /app/playwright-reports/ && echo \"Moving subfolders of playwright-reports...\" && - find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \;; echo \"Current directory:\" && pwd && echo \"Contents of current dir: \" && ls && echo \"Contents of playwright-reports:\" && ls ./playwright-reports/; echo \"Merging reports...\" && npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports; echo \"Contents of current dir: \" && ls && echo \"Contents of playwright-reports:\" && ls && ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" \"AUTOMATED TEST RUN: $(date)\" \"./ortoni-report/index.html\"") + find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \;; echo \"Current directory:\" && pwd && echo \"Contents of current dir: \" && ls && echo \"Contents of playwright-reports:\" && ls ./playwright-reports/; echo \"Merging reports...\" && npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports; echo \"Contents of current dir: \" && ls && echo \"Contents of playwright-reports:\" && ls && ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" /app/ortoni-report/index.html \"AUTOMATED TEST RUN: $(date)\"") # Start container and stream logs echo "Starting merge" docker start -a $container_id + # Create directory for test results + echo "Creating test results directory..." + mkdir -p $(System.DefaultWorkingDirectory)/ortoni-report + + # Copy test results from container + echo "Copying test results..." + docker cp $container_id:/app/ortoni-report/. $(System.DefaultWorkingDirectory)/ortoni-report + # TODO: Update to include junit results if necessary + # Remove container echo "Cleaning up container..." docker rm $container_id From e49152c990813c1438905ad19c74d5a017f54b51 Mon Sep 17 00:00:00 2001 From: Chase King Date: Thu, 27 Feb 2025 12:58:00 -0500 Subject: [PATCH 53/58] Attempt #38 --- azure-pipelines-automated-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index 230355d7..af19f67b 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -159,7 +159,7 @@ stages: -e PLAYWRIGHT_JUNIT_OUTPUT_FILE=$(PLAYWRIGHT_JUNIT_OUTPUT_FILE) \ $(dockerImageName):$(imageTag) \ bash -c "echo \"Contents of /app/playwright-reports/:\" && ls /app/playwright-reports/ && echo \"Moving subfolders of playwright-reports...\" && - find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \;; echo \"Current directory:\" && pwd && echo \"Contents of current dir: \" && ls && echo \"Contents of playwright-reports:\" && ls ./playwright-reports/; echo \"Merging reports...\" && npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports; echo \"Contents of current dir: \" && ls && echo \"Contents of playwright-reports:\" && ls && ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" /app/ortoni-report/index.html \"AUTOMATED TEST RUN: $(date)\"") + find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \;; echo \"Current directory:\" && pwd && echo \"Contents of current dir: \" && ls && echo \"Contents of playwright-reports:\" && ls ./playwright-reports/; echo \"Merging reports...\" && npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports; echo \"Contents of current dir: \" && ls && echo \"Contents of ortoni-report:\" && ls ./ortoni-report && ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" /app/ortoni-report/ortoni-report.html \"AUTOMATED TEST RUN: $(date)\"") # Start container and stream logs echo "Starting merge" docker start -a $container_id From 131a47ebd62340246bdec026cacbd36c175a4190 Mon Sep 17 00:00:00 2001 From: Chase King Date: Thu, 27 Feb 2025 14:58:07 -0500 Subject: [PATCH 54/58] Added a message to Jira report --- azure-pipelines-automated-testing.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index af19f67b..a1503a3c 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -158,8 +158,17 @@ stages: -e JIRA_API_KEY=$(JIRA_API_KEY) \ -e PLAYWRIGHT_JUNIT_OUTPUT_FILE=$(PLAYWRIGHT_JUNIT_OUTPUT_FILE) \ $(dockerImageName):$(imageTag) \ - bash -c "echo \"Contents of /app/playwright-reports/:\" && ls /app/playwright-reports/ && echo \"Moving subfolders of playwright-reports...\" && - find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \;; echo \"Current directory:\" && pwd && echo \"Contents of current dir: \" && ls && echo \"Contents of playwright-reports:\" && ls ./playwright-reports/; echo \"Merging reports...\" && npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports; echo \"Contents of current dir: \" && ls && echo \"Contents of ortoni-report:\" && ls ./ortoni-report && ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" /app/ortoni-report/ortoni-report.html \"AUTOMATED TEST RUN: $(date)\"") + bash -c "echo \"Moving Playwright reports out of subfolders...\" && + find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \; && + echo \"Merging reports...\" && + PLAYWRIGHT_JUNIT_OUTPUT_FILE=$PLAYWRIGHT_JUNIT_OUTPUT_FILE npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports + num_failures=$(sed -n 's/.*failures="\([^"]*\)".*/\1/p' $PLAYWRIGHT_JUNIT_OUTPUT_FILE | head -n 1) + echo \"Number of test failures: '$num_failures'\" + (($num_failures == 0)) && jira_message='Playwright tests passed! ✅' || jira_message=\"$num_failures Playwright tests failed. ❌\" + echo \"Contents of ortoni-report:\" && ls ./ortoni-report && + echo \"Writing report to Jira card '$(Build.SourceBranchName)'...\" && + ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" /app/ortoni-report/ortoni-report.html \"AUTOMATED TEST RUN: $(date)\" \"$jira_message\" ") + # Start container and stream logs echo "Starting merge" docker start -a $container_id @@ -171,6 +180,7 @@ stages: # Copy test results from container echo "Copying test results..." docker cp $container_id:/app/ortoni-report/. $(System.DefaultWorkingDirectory)/ortoni-report + docker cp $container_id:/app/junit-results.xml $(System.DefaultWorkingDirectory) # TODO: Update to include junit results if necessary # Remove container @@ -178,7 +188,7 @@ stages: docker rm $container_id env: JIRA_API_KEY: $(JIRA_API_KEY) - PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" + PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/junit_results.xml" displayName: merge_and_publish_results_to_jira # TODO: Enable later when working on PR gate @@ -187,7 +197,7 @@ stages: # inputs: # searchFolder: 'test-results' # testResultsFormat: 'JUnit' - # testResultsFiles: 'results.xml' + # testResultsFiles: 'junit_results.xml' # mergeTestResults: true # failTaskOnFailedTests: false # testRunTitle: 'Playwright Tests' From 86009a7c075315fb9dadd61c74b98b6b348a890e Mon Sep 17 00:00:00 2001 From: Chase King Date: Thu, 27 Feb 2025 15:30:16 -0500 Subject: [PATCH 55/58] Attempt #39 --- azure-pipelines-automated-testing.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index a1503a3c..b118c19a 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -161,10 +161,10 @@ stages: bash -c "echo \"Moving Playwright reports out of subfolders...\" && find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \; && echo \"Merging reports...\" && - PLAYWRIGHT_JUNIT_OUTPUT_FILE=$PLAYWRIGHT_JUNIT_OUTPUT_FILE npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports - num_failures=$(sed -n 's/.*failures="\([^"]*\)".*/\1/p' $PLAYWRIGHT_JUNIT_OUTPUT_FILE | head -n 1) + PLAYWRIGHT_JUNIT_OUTPUT_FILE=$(PLAYWRIGHT_JUNIT_OUTPUT_FILE) npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports + num_failures=$(sed -n 's/.*failures="\([^"]*\)".*/\1/p' "/app/$PLAYWRIGHT_JUNIT_OUTPUT_FILE" | head -n 1) echo \"Number of test failures: '$num_failures'\" - (($num_failures == 0)) && jira_message='Playwright tests passed! ✅' || jira_message=\"$num_failures Playwright tests failed. ❌\" + (($num_failures -eq 0)) && jira_message='Playwright tests passed!' || jira_message=\"$num_failures Playwright tests failed.\" echo \"Contents of ortoni-report:\" && ls ./ortoni-report && echo \"Writing report to Jira card '$(Build.SourceBranchName)'...\" && ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" /app/ortoni-report/ortoni-report.html \"AUTOMATED TEST RUN: $(date)\" \"$jira_message\" ") @@ -180,7 +180,7 @@ stages: # Copy test results from container echo "Copying test results..." docker cp $container_id:/app/ortoni-report/. $(System.DefaultWorkingDirectory)/ortoni-report - docker cp $container_id:/app/junit-results.xml $(System.DefaultWorkingDirectory) + docker cp $container_id:/app/$(PLAYWRIGHT_JUNIT_OUTPUT_FILE) $(System.DefaultWorkingDirectory) # TODO: Update to include junit results if necessary # Remove container From 7e64e0eee4b12598025c037e53c8d8e321c6fbfa Mon Sep 17 00:00:00 2001 From: Chase King Date: Thu, 27 Feb 2025 16:05:14 -0500 Subject: [PATCH 56/58] Updated reporter config --- .gitignore | 1 + azure-pipelines-automated-testing.yml | 8 +++----- playwright-tests/playwright.config.ts | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index c859f2d5..57ddef5d 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ pnpm-debug.log* # Playwright /test-results/ +/ortoni-report/ /playwright-report/ /blob-report/ /playwright/.cache/ diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index b118c19a..a4469639 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -156,13 +156,12 @@ stages: -e JIRA_SERVER=$(JIRA_SERVER) \ -e JIRA_USERNAME=$(JIRA_USERNAME) \ -e JIRA_API_KEY=$(JIRA_API_KEY) \ - -e PLAYWRIGHT_JUNIT_OUTPUT_FILE=$(PLAYWRIGHT_JUNIT_OUTPUT_FILE) \ $(dockerImageName):$(imageTag) \ bash -c "echo \"Moving Playwright reports out of subfolders...\" && find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \; && echo \"Merging reports...\" && - PLAYWRIGHT_JUNIT_OUTPUT_FILE=$(PLAYWRIGHT_JUNIT_OUTPUT_FILE) npx playwright merge-reports --reporter=ortoni-report,junit ./playwright-reports - num_failures=$(sed -n 's/.*failures="\([^"]*\)".*/\1/p' "/app/$PLAYWRIGHT_JUNIT_OUTPUT_FILE" | head -n 1) + npx playwright merge-reports --config=playwright-tests/playwright.config.ts ./playwright-reports + num_failures=$(sed -n 's/.*failures="\([^"]*\)".*/\1/p' /app/test-results/junit_results.xml | head -n 1) echo \"Number of test failures: '$num_failures'\" (($num_failures -eq 0)) && jira_message='Playwright tests passed!' || jira_message=\"$num_failures Playwright tests failed.\" echo \"Contents of ortoni-report:\" && ls ./ortoni-report && @@ -180,7 +179,7 @@ stages: # Copy test results from container echo "Copying test results..." docker cp $container_id:/app/ortoni-report/. $(System.DefaultWorkingDirectory)/ortoni-report - docker cp $container_id:/app/$(PLAYWRIGHT_JUNIT_OUTPUT_FILE) $(System.DefaultWorkingDirectory) + docker cp $container_id:/app/test-results/junit_results.xml $(System.DefaultWorkingDirectory) # TODO: Update to include junit results if necessary # Remove container @@ -188,7 +187,6 @@ stages: docker rm $container_id env: JIRA_API_KEY: $(JIRA_API_KEY) - PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/junit_results.xml" displayName: merge_and_publish_results_to_jira # TODO: Enable later when working on PR gate diff --git a/playwright-tests/playwright.config.ts b/playwright-tests/playwright.config.ts index 59a42657..bb5e6134 100644 --- a/playwright-tests/playwright.config.ts +++ b/playwright-tests/playwright.config.ts @@ -28,7 +28,7 @@ if (!process.env.CI) { const reportConfig: OrtoniReportConfig = { port: 1994, open: "never", - folderPath: "test-results", + folderPath: "ortoni-report", filename: "index.html", logo: "../business-logic/data/logo.png", title: "Test Report", @@ -55,7 +55,7 @@ export default defineConfig({ /* Reporter to use. See https://playwright.dev/docs/test-reporters */ reporter: [ ['ortoni-report', reportConfig], - ['junit'], + ['junit', {outputFile: '../test-results/junit_results.xml'}], ['list'] ], timeout: 240_000, From f246351b837db06e7bcde3dd90906e1f29aaab0b Mon Sep 17 00:00:00 2001 From: Chase King Date: Fri, 28 Feb 2025 14:52:37 -0500 Subject: [PATCH 57/58] Fixed to work the previous way --- azure-pipelines-automated-testing.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml index a4469639..bed6c877 100644 --- a/azure-pipelines-automated-testing.yml +++ b/azure-pipelines-automated-testing.yml @@ -160,13 +160,15 @@ stages: bash -c "echo \"Moving Playwright reports out of subfolders...\" && find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \; && echo \"Merging reports...\" && - npx playwright merge-reports --config=playwright-tests/playwright.config.ts ./playwright-reports - num_failures=$(sed -n 's/.*failures="\([^"]*\)".*/\1/p' /app/test-results/junit_results.xml | head -n 1) - echo \"Number of test failures: '$num_failures'\" - (($num_failures -eq 0)) && jira_message='Playwright tests passed!' || jira_message=\"$num_failures Playwright tests failed.\" + npx playwright merge-reports --reporter=ortoni-report ./playwright-reports + # npx playwright merge-reports --config=playwright-tests/playwright.config.ts ./playwright-reports + # num_failures=$(sed -n 's/.*failures="\([^"]*\)".*/\1/p' /app/test-results/junit_results.xml | head -n 1) + # echo \"Number of test failures: '$num_failures'\" + # (($num_failures -eq 0)) && jira_message='Playwright tests passed!' || jira_message=\"$num_failures Playwright tests failed.\" + # TODO: Update to include test status message later echo \"Contents of ortoni-report:\" && ls ./ortoni-report && echo \"Writing report to Jira card '$(Build.SourceBranchName)'...\" && - ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" /app/ortoni-report/ortoni-report.html \"AUTOMATED TEST RUN: $(date)\" \"$jira_message\" ") + ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" /app/ortoni-report/ortoni-report.html \"AUTOMATED TEST RUN: $(date)\" ") # Start container and stream logs echo "Starting merge" @@ -179,7 +181,7 @@ stages: # Copy test results from container echo "Copying test results..." docker cp $container_id:/app/ortoni-report/. $(System.DefaultWorkingDirectory)/ortoni-report - docker cp $container_id:/app/test-results/junit_results.xml $(System.DefaultWorkingDirectory) + # docker cp $container_id:/app/test-results/junit_results.xml $(System.DefaultWorkingDirectory) # TODO: Update to include junit results if necessary # Remove container From 4aa67e43db1bbecec5e25b7c73b6808c1a077e12 Mon Sep 17 00:00:00 2001 From: Chase King Date: Fri, 28 Feb 2025 15:13:24 -0500 Subject: [PATCH 58/58] Moved changes to main pipeline --- azure-pipelines-automated-testing.yml | 475 -------------------------- azure-pipelines.yml | 91 +++-- 2 files changed, 64 insertions(+), 502 deletions(-) delete mode 100644 azure-pipelines-automated-testing.yml diff --git a/azure-pipelines-automated-testing.yml b/azure-pipelines-automated-testing.yml deleted file mode 100644 index bed6c877..00000000 --- a/azure-pipelines-automated-testing.yml +++ /dev/null @@ -1,475 +0,0 @@ -trigger: - branches: - include: [ develop, release/* ] - paths: - exclude: - - deployment/* - include: - - "*" -pr: - branches: - include: [ '*' ] - paths: - exclude: - - deployment/* - include: - - "*" - -resources: - containers: - - container: node - image: packagerepository.sagaws.net:8082/safelite/node-build:18 - - container: awscli - image: packagerepository.sagaws.net:8082/safelite/awscli2-build:3.9 - repositories: - - repository: AzureDevOps - type: github - name: Safelite/AzureDevOps - endpoint: Safelite - ref: refs/tags/t5.5.40 - -variables: - - group: Digital-Infrastructure - - group: ISS-BuildBranches - - name: dockerImageName - value: 'playwright-tests' - - name: imageTag - value: '$(Build.BuildId)' - - name: totalShards - value: 40 # TODO: Temporarily changed to 40, change back to 4 - -stages: - # PR's - - ${{ if or(eq(variables['Build.Reason'], 'PullRequest'), eq(1,1)) }}: # TODO: Temporarily changed to always be true, change back - # TODO: Temporarily commented out - - stage: TestPr - displayName: Run Tests For PullRequest - jobs: - # - template: templates/digital/vue-jest-run-unit-tests.yml@AzureDevOps - # parameters: - # nodeContainer: node - # npmLocation: $(Build.SourcesDirectory) - # testResultsFile: junit.xml - # summaryFileLocation: $(Build.SourcesDirectory)/coverage/cobertura-coverage.xml - - job: playwright_tests - continueOnError: true - strategy: - matrix: - shard1: - shardNumber: 1 - shard2: - shardNumber: 2 - shard3: - shardNumber: 3 - shard4: - shardNumber: 4 - - steps: - - task: Docker@2 - displayName: 'Build Docker Image' - inputs: - command: build - dockerfile: Dockerfile.playwright - repository: $(dockerImageName) - tags: $(imageTag) - arguments: '--no-cache --pull' - - - script: | - # Create container and run tests - container_id=$(docker create \ - --ipc=host \ - -e CCIS_API_AUTH=$(CCIS_API_AUTH) \ - -e BASE_URL=$(BASE_URL) \ - -e CCIS_API_URL=$(CCIS_API_URL) \ - -e ADMIN_SERVICE_API_URL=$(ADMIN_SERVICE_API_URL) \ - -e SHARD=$(shardNumber) \ - -e CI=true \ - -e NODE_ENV=$(NODE_ENV) \ - $(dockerImageName):$(imageTag) \ - npx concurrently -k -n "server,playwright"\ - "sed -i \"s|^process\.env\.VUE_APP_CONSUMER_CF_DISTRO = .*|process\.env\.VUE_APP_CONSUMER_CF_DISTRO='https://digitalapi.test.safelite.io'|\" \"./vue.config.js\" && echo \"Updated config file to use TEST APIs\" && npm run serve -- --port=8080"\ - "npx wait-on http://localhost:8080 && npm run test:playwright -- --shard=$(shardNumber)/$(totalShards) --reporter=list,blob --grep \"@smoke | @Advanced\"") - - # Start container and stream logs - echo "Starting tests for shard $(shardNumber)..." - docker start -a $container_id - - # Create directory for test results - echo "Creating test results directory..." - mkdir -p $(System.DefaultWorkingDirectory)/blob-reports/shard-$(shardNumber) - - # Copy test results from container - echo "Copying test results..." - docker cp $container_id:/app/blob-report/. $(System.DefaultWorkingDirectory)/blob-reports/shard-$(shardNumber)/ - - # Remove container - echo "Cleaning up container..." - docker rm $container_id - - # Check if tests failed - if [ $? -ne 0 ]; then - echo "Tests failed in shard $(shardNumber)!" - exit 1 - fi - displayName: 'Run Playwright Tests - Shard $(shardNumber)' - - - task: PublishPipelineArtifact@1 - displayName: 'Publish Test Reports - Shard $(shardNumber)' - condition: always() - inputs: - targetPath: '$(System.DefaultWorkingDirectory)/blob-reports/shard-$(shardNumber)' - artifact: 'playwright-report-shard-$(shardNumber)' - publishLocation: 'pipeline' - - - script: | - docker rmi $(dockerImageName):$(imageTag) -f - displayName: 'Cleanup Docker Image' - condition: always() - - - job: download_and_merge_reports - dependsOn: playwright_tests - steps: - - task: DownloadPipelineArtifact@2 - inputs: - targetPath: '$(System.DefaultWorkingDirectory)/playwright-reports' - # - script: | - # for dir in $(System.DefaultWorkingDirectory)/playwright-reports/*/; do - # if [ -d "$dir" ]; then - # mv "$dir"* $(System.DefaultWorkingDirectory)/playwright-reports/ - # rmdir "$dir" - # fi - # done - # ls - # displayName: move_reports - - task: Docker@2 - displayName: 'Build Docker Image' - inputs: - command: build - dockerfile: Dockerfile.playwright - repository: $(dockerImageName) - tags: $(imageTag) - arguments: '--no-cache --pull' - - bash: | - # Create container for jira writeback - container_id=$(docker create \ - --ipc=host \ - -e JIRA_SERVER=$(JIRA_SERVER) \ - -e JIRA_USERNAME=$(JIRA_USERNAME) \ - -e JIRA_API_KEY=$(JIRA_API_KEY) \ - $(dockerImageName):$(imageTag) \ - bash -c "echo \"Moving Playwright reports out of subfolders...\" && - find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \; && - echo \"Merging reports...\" && - npx playwright merge-reports --reporter=ortoni-report ./playwright-reports - # npx playwright merge-reports --config=playwright-tests/playwright.config.ts ./playwright-reports - # num_failures=$(sed -n 's/.*failures="\([^"]*\)".*/\1/p' /app/test-results/junit_results.xml | head -n 1) - # echo \"Number of test failures: '$num_failures'\" - # (($num_failures -eq 0)) && jira_message='Playwright tests passed!' || jira_message=\"$num_failures Playwright tests failed.\" - # TODO: Update to include test status message later - echo \"Contents of ortoni-report:\" && ls ./ortoni-report && - echo \"Writing report to Jira card '$(Build.SourceBranchName)'...\" && - ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" /app/ortoni-report/ortoni-report.html \"AUTOMATED TEST RUN: $(date)\" ") - - # Start container and stream logs - echo "Starting merge" - docker start -a $container_id - - # Create directory for test results - echo "Creating test results directory..." - mkdir -p $(System.DefaultWorkingDirectory)/ortoni-report - - # Copy test results from container - echo "Copying test results..." - docker cp $container_id:/app/ortoni-report/. $(System.DefaultWorkingDirectory)/ortoni-report - # docker cp $container_id:/app/test-results/junit_results.xml $(System.DefaultWorkingDirectory) - # TODO: Update to include junit results if necessary - - # Remove container - echo "Cleaning up container..." - docker rm $container_id - env: - JIRA_API_KEY: $(JIRA_API_KEY) - displayName: merge_and_publish_results_to_jira - - # TODO: Enable later when working on PR gate - # - task: PublishTestResults@2 - # displayName: 'Publish test results' - # inputs: - # searchFolder: 'test-results' - # testResultsFormat: 'JUnit' - # testResultsFiles: 'junit_results.xml' - # mergeTestResults: true - # failTaskOnFailedTests: false - # testRunTitle: 'Playwright Tests' - # condition: succeededOrFailed() - - - task: PublishPipelineArtifact@1 - displayName: 'Publish Merged Report' - condition: always() - inputs: - targetPath: '$(System.DefaultWorkingDirectory)/ortoni-report' - artifact: 'playwright-merged-report' - publishLocation: 'pipeline' - - script: | - docker rmi $(dockerImageName):$(imageTag) -f - displayName: 'Cleanup Docker Image' - condition: always() - - - ${{ else }}: - # Dev Build/Deploy - - stage: Dev - condition: eq(variables['Build.SourceBranch'], variables['dev-branch'] ) - variables: - - group: ISS-Dev - jobs: - - deployment: devBuildDeployment - displayName: Build and Deploy ISS - Dev - environment: digitalCloud-dev - container: node - workspace: - clean: all - strategy: - runOnce: - deploy: - steps: - - checkout: self - clean: true - - task: CopyFiles@2 - inputs: - SourceFolder: 'public/apple-pay/dev' - Contents: '**' - TargetFolder: 'public/.well-known' - CleanTargetFolder: true - - task: DeleteFiles@1 - inputs: - SourceFolder: 'public/apple-pay' - Contents: '**' - RemoveSourceFolder: true - - template: templates/digital/step-build-vue.yml@AzureDevOps - parameters: - buildOutputDir: dist - environment: Dev - - template: templates/digital/step-deploy-vue.yml@AzureDevOps - parameters: - artifactName: vueDistDev - awsProfile: $(devDeploymentProfile) - deployBuckets: - safelite-dev-iss-us-east-2: - clearFolder: true - deployFolder: '' - region: us-east-2 - safelite-dev-iss-us-east-1: - clearFolder: true - deployFolder: '' - region: us-east-1 - appDeployVariables: - __VUE_APP_CONSUMER_CF_DISTRO__: $(__VUE_APP_CONSUMER_CF_DISTRO__) - __VUE_APP_CURRENT_ENVIRONMENT__: $(__VUE_APP_CURRENT_ENVIRONMENT__) - __VUE_APP_CUSTOMER_PORTAL_URL__: $(__VUE_APP_CUSTOMER_PORTAL_URL__) - __VUE_APP_GOOGLE_PLACES_API_KEY__: $(__VUE_APP_GOOGLE_PLACES_API_KEY__) - __VUE_APP_SAFELITE_HOP__: $(__VUE_APP_SAFELITE_HOP__) - indexDeployVariables: - __VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__) - __VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__) - __VUE_APP_GOOGLE_MAPS_API_SCRIPT__: $(__VUE_APP_GOOGLE_MAPS_API_SCRIPT__) - - template: templates/digital/invalidate-cloudfront-cache.yml@AzureDevOps - parameters: - awsCliContainer: awscli - distributionId: $(cfDistributionId) - paths: /* - awsProfile: $(devDeploymentProfile) - - # Test Build/Deploy - - stage: Test - condition: eq(variables['Build.SourceBranch'], variables['test-branch'] ) - variables: - - group: ISS-Test - jobs: - - deployment: testBuildDeployment - displayName: Build and Deploy ISS - Test - environment: NoApproval-All - container: node - workspace: - clean: all - strategy: - runOnce: - deploy: - steps: - - checkout: self - clean: true - - task: CopyFiles@2 - inputs: - SourceFolder: 'public/apple-pay/test' - Contents: '**' - TargetFolder: 'public/.well-known' - CleanTargetFolder: true - - task: DeleteFiles@1 - inputs: - SourceFolder: 'public/apple-pay' - Contents: '**' - RemoveSourceFolder: true - - template: templates/digital/step-build-vue.yml@AzureDevOps - parameters: - buildOutputDir: dist - environment: Test - - template: templates/digital/step-deploy-vue.yml@AzureDevOps - parameters: - artifactName: vueDistTest - awsProfile: $(sysDeploymentProfile) - deployBuckets: - safelite-sys-iss-us-east-1: - clearFolder: true - deployFolder: "" - region: us-east-1 - safelite-sys-iss-us-east-2: - clearFolder: true - deployFolder: "" - region: us-east-2 - appDeployVariables: - __VUE_APP_CONSUMER_CF_DISTRO__: $(__VUE_APP_CONSUMER_CF_DISTRO__) - __VUE_APP_CURRENT_ENVIRONMENT__: $(__VUE_APP_CURRENT_ENVIRONMENT__) - __VUE_APP_CUSTOMER_PORTAL_URL__: $(__VUE_APP_CUSTOMER_PORTAL_URL__) - __VUE_APP_GOOGLE_PLACES_API_KEY__: $(__VUE_APP_GOOGLE_PLACES_API_KEY__) - __VUE_APP_SAFELITE_HOP__: $(__VUE_APP_SAFELITE_HOP__) - indexDeployVariables: - __VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__) - __VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__) - __VUE_APP_GOOGLE_MAPS_API_SCRIPT__: $(__VUE_APP_GOOGLE_MAPS_API_SCRIPT__) - - template: templates/digital/invalidate-cloudfront-cache.yml@AzureDevOps - parameters: - awsCliContainer: awscli - distributionId: $(cfDistributionId) - paths: /* - awsProfile: $(sysDeploymentProfile) - - # QA Build/Deploy - - stage: QA - condition: eq(variables['Build.SourceBranch'], variables['qa-branch'] ) - variables: - - group: ISS-QA - jobs: - - deployment: qaBuildDeployment - displayName: Build and Deploy ISS - QA - environment: NoApproval-All - container: node - workspace: - clean: all - strategy: - runOnce: - deploy: - steps: - - checkout: self - clean: true - - task: CopyFiles@2 - inputs: - SourceFolder: 'public/apple-pay/qa' - Contents: '**' - TargetFolder: 'public/.well-known' - CleanTargetFolder: true - - task: DeleteFiles@1 - inputs: - SourceFolder: 'public/apple-pay' - Contents: '**' - RemoveSourceFolder: true - - template: templates/digital/step-build-vue.yml@AzureDevOps - parameters: - buildOutputDir: dist - environment: Qa - - template: templates/digital/step-deploy-vue.yml@AzureDevOps - parameters: - artifactName: vueDistQa - awsProfile: $(qaDeploymentProfile) - deployBuckets: - safelite-qa-iss-us-east-1: - clearFolder: true - deployFolder: "" - region: us-east-1 - safelite-qa-iss-us-east-2: - clearFolder: true - deployFolder: "" - region: us-east-2 - appDeployVariables: - __VUE_APP_CONSUMER_CF_DISTRO__: $(__VUE_APP_CONSUMER_CF_DISTRO__) - __VUE_APP_CURRENT_ENVIRONMENT__: $(__VUE_APP_CURRENT_ENVIRONMENT__) - __VUE_APP_CUSTOMER_PORTAL_URL__: $(__VUE_APP_CUSTOMER_PORTAL_URL__) - __VUE_APP_GOOGLE_PLACES_API_KEY__: $(__VUE_APP_GOOGLE_PLACES_API_KEY__) - __VUE_APP_SAFELITE_HOP__: $(__VUE_APP_SAFELITE_HOP__) - indexDeployVariables: - __VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__) - __VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__) - __VUE_APP_GOOGLE_MAPS_API_SCRIPT__: $(__VUE_APP_GOOGLE_MAPS_API_SCRIPT__) - - template: templates/digital/invalidate-cloudfront-cache.yml@AzureDevOps - parameters: - awsCliContainer: awscli - distributionId: $(cfDistributionId) - paths: /* - awsProfile: $(qaDeploymentProfile) - - # Prod Build/Deploy - - stage: Prod - condition: succeeded('QA') - variables: - - group: ISS-Prod - jobs: - - deployment: prodBuildDeployment - displayName: Build and Deploy ISS - Prod - environment: digitalCloud-prod - container: node - workspace: - clean: all - strategy: - runOnce: - deploy: - steps: - - checkout: self - clean: true - - task: CopyFiles@2 - inputs: - SourceFolder: 'public/apple-pay/prod' - Contents: '**' - TargetFolder: 'public/.well-known' - CleanTargetFolder: true - - task: DeleteFiles@1 - inputs: - SourceFolder: 'public/apple-pay' - Contents: '**' - RemoveSourceFolder: true - - template: templates/digital/step-build-vue.yml@AzureDevOps - parameters: - buildOutputDir: dist - environment: Prod - - template: templates/digital/step-deploy-vue.yml@AzureDevOps - parameters: - artifactName: vueDistProd - awsProfile: $(prodDeploymentProfile) - deployBuckets: - safelite-prod-iss-us-east-1: - clearFolder: true - deployFolder: "" - region: us-east-1 - safelite-prod-iss-us-east-2: - clearFolder: true - deployFolder: "" - region: us-east-2 - appDeployVariables: - __VUE_APP_CONSUMER_CF_DISTRO__: $(__VUE_APP_CONSUMER_CF_DISTRO__) - __VUE_APP_CURRENT_ENVIRONMENT__: $(__VUE_APP_CURRENT_ENVIRONMENT__) - __VUE_APP_CUSTOMER_PORTAL_URL__: $(__VUE_APP_CUSTOMER_PORTAL_URL__) - __VUE_APP_GOOGLE_PLACES_API_KEY__: $(__VUE_APP_GOOGLE_PLACES_API_KEY__) - __VUE_APP_SAFELITE_HOP__: $(__VUE_APP_SAFELITE_HOP__) - indexDeployVariables: - __VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__: $(__VUE_APP_GOOGLE_TAG_MANAGER_SCRIPT_BODY__) - __VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__: $(__VUE_APP_GOOGLE_TAG_MANAGER_NOSCRIPT_FRAME_SRC__) - __VUE_APP_GOOGLE_MAPS_API_SCRIPT__: $(__VUE_APP_GOOGLE_MAPS_API_SCRIPT__) - - template: templates/digital/invalidate-cloudfront-cache.yml@AzureDevOps - parameters: - awsCliContainer: awscli - distributionId: $(cfDistributionId) - paths: /* - awsProfile: $(prodDeploymentProfile) - - template: templates/digital/auto-tag.yml@AzureDevOps - parameters: - dependsOn: prodBuildDeployment - userName: SafeliteAzureDevops - userEmail: githubazuredevops@safelite.com - diff --git a/azure-pipelines.yml b/azure-pipelines.yml index cedebb5b..6bddeece 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -90,7 +90,6 @@ stages: "npx wait-on http://localhost:8080 && npm run test:playwright -- --shard=$(shardNumber)/$(totalShards) --reporter=list,blob --grep \"@smoke | @Advanced\"") # Start container and stream logs - echo "Starting tests for shard $(shardNumber)..." docker start -a $container_id @@ -127,26 +126,60 @@ stages: condition: always() - job: download_and_merge_reports - container: - image: mcr.microsoft.com/playwright:v1.48.0-noble dependsOn: playwright_tests steps: - - task: DownloadPipelineArtifact@2 - inputs: - targetPath: '$(System.DefaultWorkingDirectory)/playwright-reports' - - script: | - npm i ortoni-report && - for dir in $(System.DefaultWorkingDirectory)/playwright-reports/*/; do - if [ -d "$dir" ]; then - mv "$dir"* $(System.DefaultWorkingDirectory)/playwright-reports/ - rmdir "$dir" - fi - done - npx playwright merge-reports --reporter=ortoni-report,junit $(System.DefaultWorkingDirectory)/playwright-reports - ls - displayName: merge_reports - env: - PLAYWRIGHT_JUNIT_OUTPUT_FILE: "test-results/results.xml" + - task: DownloadPipelineArtifact@2 + inputs: + targetPath: '$(System.DefaultWorkingDirectory)/playwright-reports' + - task: Docker@2 + displayName: 'Build Docker Image' + inputs: + command: build + dockerfile: Dockerfile.playwright + repository: $(dockerImageName) + tags: $(imageTag) + arguments: '--no-cache --pull' + - bash: | + # Create container for jira writeback + container_id=$(docker create \ + --ipc=host \ + -e JIRA_SERVER=$(JIRA_SERVER) \ + -e JIRA_USERNAME=$(JIRA_USERNAME) \ + -e JIRA_API_KEY=$(JIRA_API_KEY) \ + $(dockerImageName):$(imageTag) \ + bash -c "echo \"Moving Playwright reports out of subfolders...\" && + find ./playwright-reports/ -mindepth 2 -type f -exec mv {} ./playwright-reports/ \; && + echo \"Merging reports...\" && + npx playwright merge-reports --reporter=ortoni-report ./playwright-reports + # npx playwright merge-reports --config=playwright-tests/playwright.config.ts ./playwright-reports + # num_failures=$(sed -n 's/.*failures="\([^"]*\)".*/\1/p' /app/test-results/junit_results.xml | head -n 1) + # echo \"Number of test failures: '$num_failures'\" + # (($num_failures -eq 0)) && jira_message='Playwright tests passed!' || jira_message=\"$num_failures Playwright tests failed.\" + # TODO: Update to include test status message later + echo \"Contents of ortoni-report:\" && ls ./ortoni-report && + echo \"Writing report to Jira card '$(Build.SourceBranchName)'...\" && + ./devops/scripts/jira_writeback.sh add_comment \"$(Build.SourceBranchName)\" /app/ortoni-report/ortoni-report.html \"AUTOMATED TEST RUN: $(date)\" ") + + # Start container and stream logs + echo "Starting merge" + docker start -a $container_id + + # Create directory for test results + echo "Creating test results directory..." + mkdir -p $(System.DefaultWorkingDirectory)/ortoni-report + + # Copy test results from container + echo "Copying test results..." + docker cp $container_id:/app/ortoni-report/. $(System.DefaultWorkingDirectory)/ortoni-report + # docker cp $container_id:/app/test-results/junit_results.xml $(System.DefaultWorkingDirectory) + # TODO: Update to include junit results if necessary + + # Remove container + echo "Cleaning up container..." + docker rm $container_id + env: + JIRA_API_KEY: $(JIRA_API_KEY) + displayName: merge_and_publish_results_to_jira # TODO: Enable later when working on PR gate # - task: PublishTestResults@2 @@ -154,19 +187,23 @@ stages: # inputs: # searchFolder: 'test-results' # testResultsFormat: 'JUnit' - # testResultsFiles: 'results.xml' + # testResultsFiles: 'junit_results.xml' # mergeTestResults: true # failTaskOnFailedTests: false # testRunTitle: 'Playwright Tests' # condition: succeededOrFailed() - - task: PublishPipelineArtifact@1 - displayName: 'Publish Merged Report' - condition: always() - inputs: - targetPath: '$(System.DefaultWorkingDirectory)/ortoni-report' - artifact: 'playwright-merged-report' - publishLocation: 'pipeline' + - task: PublishPipelineArtifact@1 + displayName: 'Publish Merged Report' + condition: always() + inputs: + targetPath: '$(System.DefaultWorkingDirectory)/ortoni-report' + artifact: 'playwright-merged-report' + publishLocation: 'pipeline' + - script: | + docker rmi $(dockerImageName):$(imageTag) -f + displayName: 'Cleanup Docker Image' + condition: always() - ${{ else }}: # Dev Build/Deploy