From 14846d2055483bcb4c0dc2d37e4520ff7f3b6d24 Mon Sep 17 00:00:00 2001 From: shilongliu Date: Mon, 20 Jun 2022 14:30:22 +0800 Subject: [PATCH 1/2] [build] Add version files to docker image dependencies --- Makefile.cache | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile.cache b/Makefile.cache index 8ac02b73b383..421b87720d3f 100644 --- a/Makefile.cache +++ b/Makefile.cache @@ -558,6 +558,12 @@ define SHA_DEP_RULES ALL_DEP_FILES_LIST += $(foreach pkg,$(2), $($(filter none,$($(1)_CACHE_MODE)), \ $(addsuffix .$(3),$(addprefix $(pkg)/, $(1))) \ $(addsuffix .$(3).sha,$(addprefix $(pkg)/, $(1))))) +$(foreach docker, $(filter $(SONIC_DOCKER_IMAGES), $(1)), \ + $(eval $(docker)_DEP_FILES+=$(wildcard files/build/versions/default/*) \ + $(wildcard files/build/versions/dockers/$(basename $(docker))/*))) +$(foreach docker, $(filter $(SONIC_DOCKER_DBG_IMAGES), $(1)), \ + $(eval $(docker)_DEP_FILES+=$(wildcard files/build/versions/default/*) \ + $(wildcard files/build/versions/dockers/$(patsubst %-$(DBG_IMAGE_MARK).gz,%,$(docker))/*))) $(addsuffix .$(3),$(addprefix $(2)/, $(1))) : $(2)/%.$(3) : \ $(2)/%.flags $$$$($$$$*_DEP_FILES) $$$$(if $$$$($$$$*_SMDEP_FILES), $(2)/%.smdep) @$$(eval $$*_DEP_FILES_MODIFIED := $$? ) From 1f75d025b51696ce8e082c1f2757cb986573f33a Mon Sep 17 00:00:00 2001 From: Shilong Liu Date: Fri, 17 Jun 2022 15:39:41 +0800 Subject: [PATCH 2/2] [ci] Support to skip vstest using include/exclude config file. (#11086) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit example: ├── folderA │ ├── fileA (skip vstest) │ ├── fileB │ └── fileC If we want to skip vstest when changing /folderA/fileA, and not skip vstest when changing fileB or fileC. vstest-include: ^folderA/fileA vstest-exclude: ^folderA --- .azure-pipelines/azure-pipelines-build.yml | 1 + .azure-pipelines/template-skipvstest.yml | 12 ++++++++++++ .azure-pipelines/vstest-exclude | 3 +++ .azure-pipelines/vstest-include | 2 ++ azure-pipelines.yml | 1 + 5 files changed, 19 insertions(+) create mode 100644 .azure-pipelines/template-skipvstest.yml create mode 100644 .azure-pipelines/vstest-exclude create mode 100644 .azure-pipelines/vstest-include diff --git a/.azure-pipelines/azure-pipelines-build.yml b/.azure-pipelines/azure-pipelines-build.yml index a6a0b2768a79..09f2c852f81c 100644 --- a/.azure-pipelines/azure-pipelines-build.yml +++ b/.azure-pipelines/azure-pipelines-build.yml @@ -97,6 +97,7 @@ jobs: platform_rpc: nephos buildSteps: + - template: template-skipvstest.yml - bash: | set -ex if [ $(GROUP_NAME) == vs ]; then diff --git a/.azure-pipelines/template-skipvstest.yml b/.azure-pipelines/template-skipvstest.yml new file mode 100644 index 000000000000..b47f17ce6e81 --- /dev/null +++ b/.azure-pipelines/template-skipvstest.yml @@ -0,0 +1,12 @@ +steps: +- ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + - script: | + set -ex + tar_branch=origin/$(System.PullRequest.TargetBranch) + git diff $tar_branch..HEAD --name-only | grep -v -f .azure-pipelines/vstest-exclude && exit 0 + git diff $tar_branch..HEAD --name-only | grep -f .azure-pipelines/vstest-include && exit 0 + set +x + echo "Skip vstest jobs" + echo "##vso[task.setvariable variable=SKIP_VSTEST;isOutput=true]YES" + name: SetVar + displayName: "Check if vstest is needed." diff --git a/.azure-pipelines/vstest-exclude b/.azure-pipelines/vstest-exclude new file mode 100644 index 000000000000..71616704707a --- /dev/null +++ b/.azure-pipelines/vstest-exclude @@ -0,0 +1,3 @@ +^platform +^.azure-pipelines +^files/build/versions diff --git a/.azure-pipelines/vstest-include b/.azure-pipelines/vstest-include new file mode 100644 index 000000000000..86fb3a9d88ba --- /dev/null +++ b/.azure-pipelines/vstest-include @@ -0,0 +1,2 @@ +^platform/vs +^.azure-pipelines/run-test-template.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 60ac1c7e4fb1..1219cc81a8f7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -76,6 +76,7 @@ stages: - stage: Test dependsOn: BuildVS + condition: and(ne(stageDependencies.BuildVS.outputs['vs.SetVar.SKIP_VSTEST'], 'YES'), succeeded()) variables: - name: inventory value: veos_vtb