From 8635a5f1cf173d98585c3eac4e8777e07a8205f5 Mon Sep 17 00:00:00 2001 From: Chase King Date: Fri, 21 Feb 2025 10:56:15 -0500 Subject: [PATCH] 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)