Skip to content

Commit

Permalink
[build] Add version files to docker image dependencies (sonic-net#11195)
Browse files Browse the repository at this point in the history
* [ci] Support to skip vstest using include/exclude config file. (sonic-net#11086)

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

* [build] Add version files to docker image dependencies
  • Loading branch information
liushilongbuaa authored and skbarista committed Aug 17, 2022
1 parent 7445a96 commit fa737d3
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions .azure-pipelines/azure-pipelines-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ jobs:
platform_rpc: nephos

buildSteps:
- template: template-skipvstest.yml
- bash: |
set -ex
if [ $(GROUP_NAME) == vs ]; then
Expand Down
12 changes: 12 additions & 0 deletions .azure-pipelines/template-skipvstest.yml
Original file line number Diff line number Diff line change
@@ -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."
3 changes: 3 additions & 0 deletions .azure-pipelines/vstest-exclude
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
^platform
^.azure-pipelines
^files/build/versions
2 changes: 2 additions & 0 deletions .azure-pipelines/vstest-include
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
^platform/vs
^.azure-pipelines/run-test-template.yml
6 changes: 6 additions & 0 deletions Makefile.cache
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,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 := $$? )
Expand Down
1 change: 1 addition & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ stages:

- stage: Test
dependsOn: BuildVS
condition: and(ne(stageDependencies.BuildVS.outputs['vs.SetVar.SKIP_VSTEST'], 'YES'), succeeded())
variables:
- name: inventory
value: veos_vtb
Expand Down

0 comments on commit fa737d3

Please sign in to comment.