@@ -2,23 +2,6 @@ name: build
22
33variables :
44 - group : unittest-samples
5- - name : self_location
6- value : " self_location"
7- - name : full_self_location
8- value : " $(Agent.BuildDirectory)/$(self_location)"
9- - name : samples_location
10- value : " samples_location"
11- - name : full_samples_location
12- value : " $(Agent.BuildDirectory)/$(samples_location)"
13-
14- resources :
15- repositories :
16- - repository : unittest-samples
17- type : github
18- name : $(unittest_samples_repository)
19- ref : main
20- endpoint : github-repo-sa
21- trigger : none
225
236trigger :
247 tags :
@@ -28,54 +11,26 @@ pr: none
2811pool :
2912 vmImage : " ubuntu-20.04"
3013
31- stages :
32- - stage : deploy
33- jobs :
34- - job : deploy
35- displayName : Deploy containers to dockerhub
36- variables :
37- - group : deployment-information
38- steps :
39- - task : Docker@2
40- displayName : Login to docker hub
41- inputs :
42- command : login
43- containerRegistry : dockerhub
44- - task : Docker@2
45- displayName : Login to chimera
46- inputs :
47- command : login
48- containerRegistry : CHIMERA-U-ACR
49- - checkout : self
50- fetchDepth : 1
51- path : $(self_location)
52- - checkout : unittest-samples
53- fetchDepth : 1
54- path : $(samples_location)
55- - script : |
56- export TAG=${BUILD_SOURCEBRANCH#"refs/tags/v"}
57- if [[ "$TAG" == *stable* ]]; then export BUILD_TYPE=stable; else export BUILD_TYPE=latest; fi
58- docker build --build-arg version=$TAG --build-arg branch=$BUILD_TYPE -t cccs/${BUILD_REPOSITORY_NAME##*/}:$TAG -t cccs/${BUILD_REPOSITORY_NAME##*/}:$BUILD_TYPE -f ./Dockerfile .
59- workingDirectory: $(full_self_location)
60- displayName: Build containers
61- - script : |
62- [ ! -d "$(pwd)/tests" ] && echo "No tests found" && exit
63- export TAG=${BUILD_SOURCEBRANCH#"refs/tags/v"}
64- if [[ "$TAG" == *stable* ]]; then export BUILD_TYPE=stable; else export BUILD_TYPE=latest; fi
65- [ -f "$(pwd)/tests/requirements.txt" ] && docker run -e FULL_SELF_LOCATION=/opt/al_service -e FULL_SAMPLES_LOCATION=/opt/samples -v /usr/share/ca-certificates/mozilla:/usr/share/ca-certificates/mozilla -v $(pwd)/tests/:/opt/al_service/tests/ -v ${FULL_SAMPLES_LOCATION}:/opt/samples cccs/${BUILD_REPOSITORY_NAME##*/}:$BUILD_TYPE bash -c 'pip install -U -r tests/requirements.txt; pytest -p no:cacheprovider -vv' && exit
66- docker run -e FULL_SELF_LOCATION=/opt/al_service -e FULL_SAMPLES_LOCATION=/opt/samples -v /usr/share/ca-certificates/mozilla:/usr/share/ca-certificates/mozilla -v $(pwd)/tests/:/opt/al_service/tests/ -v ${FULL_SAMPLES_LOCATION}:/opt/samples cccs/${BUILD_REPOSITORY_NAME##*/}:$BUILD_TYPE bash -c 'pytest -p no:cacheprovider -vv'
67- workingDirectory: $(full_self_location)
68- displayName: Test containers
69- - script : |
70- export TAG=${BUILD_SOURCEBRANCH#"refs/tags/v"}
71- if [[ "$TAG" == *stable* ]]; then export BUILD_TYPE=stable; else export BUILD_TYPE=latest; fi
72- export SERIES="`expr $TAG : '\([0-9]\+\.[0-9]\+\.\)'`${BUILD_TYPE}"
14+ resources :
15+ repositories :
16+ - repository : PipelineTemplates
17+ type : github
18+ name : CybercentreCanada/assemblyline-pipeline-templates
19+ ref : refs/heads/main
20+ endpoint : github-repo-sa
21+ trigger : none
22+ - repository : unittest-samples
23+ type : github
24+ name : $(unittest_samples_repository)
25+ ref : main
26+ endpoint : github-repo-sa
27+ trigger : none
7328
74- for IMAGE in "cccs/" "uchimera.azurecr.io/cccs/"
75- do
76- docker tag cccs/${BUILD_REPOSITORY_NAME##*/}:$BUILD_TYPE ${IMAGE}${BUILD_REPOSITORY_NAME##*/}:$TAG
77- docker tag cccs/${BUILD_REPOSITORY_NAME##*/}:$BUILD_TYPE ${IMAGE}${BUILD_REPOSITORY_NAME##*/}:$BUILD_TYPE
78- docker tag cccs/${BUILD_REPOSITORY_NAME##*/}:$BUILD_TYPE ${IMAGE}${BUILD_REPOSITORY_NAME##*/}:$SERIES
79- docker push ${IMAGE}${BUILD_REPOSITORY_NAME##*/} --all-tags
80- done
81- displayName: Deploy to container repositories
29+ extends :
30+ template : stages/deploy-service.yaml@PipelineTemplates
31+ parameters :
32+ is_public : " true "
33+ samples_repo : unittest-samples
34+ labels :
35+ classification : " UNCLASSIFIED "
36+
0 commit comments