Skip to content

Commit 339c75d

Browse files
Merge branch 'master' into azure_ssh
2 parents 3f96bce + 28c86ed commit 339c75d

File tree

1 file changed

+116
-101
lines changed

1 file changed

+116
-101
lines changed

azure-pipelines.yml

Lines changed: 116 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -11,111 +11,126 @@ schedules:
1111
variables:
1212
CI: true
1313

14-
jobs:
15-
- job: package_selection
16-
${{ if eq(variables['Build.Reason'], 'PullRequest')}}:
17-
displayName: Package selection (PR)
18-
${{ else }}:
19-
displayName: Package selection
20-
pool:
21-
vmImage: ubuntu-latest
14+
pool:
15+
vmImage: ubuntu-latest
16+
17+
stages:
18+
- stage: package_selection
19+
displayName: Package selection
2220
condition: and(succeeded(), not(canceled()))
23-
steps:
24-
- task: Bash@3
25-
displayName: Get CI scripts
26-
inputs:
27-
targetType: inline
28-
script: |
29-
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/packages.sh
30-
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/azure_commit_range.py
31-
- task: Bash@3
32-
displayName: Determine packages to be build
33-
name: matrix
34-
inputs:
35-
targetType: inline
36-
script: |
37-
COMMIT_RANGE=$(python3 ./azure_commit_range.py)
38-
BRANCH=${SYSTEM_PULLREQUEST_TARGETBRANCH:-${BUILD_SOURCEBRANCH#refs/heads/}}
39-
DEFAULT_BRANCH=$(git remote show origin 2>/dev/null | grep HEAD | awk '{print $3}')
40-
ALL=$(([ "$BUILD_REASON" == "Schedule" ] || (([ "$BUILD_REASON" == "BatchedCI" ] || [ "$BUILD_REASON" == "IndividualCI" ] || [ "$BUILD_REASON" == "Manual" ]) && [ "$BRANCH" == "$DEFAULT_BRANCH" ])) && echo "true")
41-
source ./packages.sh --pullrequest=${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER:-false} --branch=$SYSTEM_PULLREQUEST_TARGETBRANCH --commit-range=$COMMIT_RANGE --all=$ALL tue_robocup challenge_following_and_guiding challenge_manipulation challenge_navigation challenge_person_recognition challenge_spr challenge_speech_recognition
42-
echo "##vso[task.setVariable variable=json_string;isOutput=true]$PACKAGES_DICT"
21+
jobs:
22+
- job: package_selection
23+
${{ if eq(variables['Build.Reason'], 'PullRequest')}}:
24+
displayName: Package selection (PR)
25+
${{ else }}:
26+
displayName: Package selection
27+
condition: and(succeeded(), not(canceled()))
28+
steps:
29+
- task: Bash@3
30+
displayName: Get CI scripts
31+
inputs:
32+
targetType: inline
33+
script: |
34+
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/packages.sh
35+
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/azure_commit_range.py
36+
- task: Bash@3
37+
displayName: Determine packages to be build
38+
name: matrix
39+
inputs:
40+
targetType: inline
41+
script: |
42+
COMMIT_RANGE=$(python3 ./azure_commit_range.py)
43+
BRANCH=${SYSTEM_PULLREQUEST_TARGETBRANCH:-${BUILD_SOURCEBRANCH#refs/heads/}}
44+
DEFAULT_BRANCH=$(git remote show origin 2>/dev/null | grep HEAD | awk '{print $3}')
45+
ALL=$(([ "$BUILD_REASON" == "Schedule" ] || (([ "$BUILD_REASON" == "BatchedCI" ] || [ "$BUILD_REASON" == "IndividualCI" ] || [ "$BUILD_REASON" == "Manual" ]) && [ "$BRANCH" == "$DEFAULT_BRANCH" ])) && echo "true")
46+
source ./packages.sh --pullrequest=${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER:-false} --branch=$SYSTEM_PULLREQUEST_TARGETBRANCH --commit-range=$COMMIT_RANGE --all=$ALL tue_robocup challenge_following_and_guiding challenge_manipulation challenge_navigation challenge_person_recognition challenge_spr challenge_speech_recognition
47+
echo "##vso[task.setVariable variable=json_string;isOutput=true]$PACKAGES_DICT"
4348
44-
- job: install_build_test
49+
- stage: install_build_test
4550
${{ if eq(variables['Build.Reason'], 'PullRequest')}}:
4651
displayName: 'Install, build & test (PR):'
4752
${{ else }}:
4853
displayName: 'Install, build & test:'
49-
pool:
50-
vmImage: ubuntu-latest
5154
dependsOn: package_selection
52-
condition: and(succeeded(), not(canceled()), ne(dependencies.package_selection.outputs['matrix.json_string'], '{}'))
53-
strategy:
54-
matrix: $[ dependencies.package_selection.outputs['matrix.json_string'] ]
55-
steps:
56-
- task: Cache@2
57-
displayName: Cache ccache
58-
inputs:
59-
key: '"$(Agent.OS)" | ccache | "$(System.TeamProject)" | $(PACKAGE) | "$(Build.SourceVersion)"'
60-
restoreKeys: |
61-
"$(Agent.OS)" | ccache | "$(System.TeamProject)" | $(PACKAGE)
62-
"$(Agent.OS)" | ccache | "$(System.TeamProject)"
63-
"$(Agent.OS)" | ccache
64-
path: $(HOME)/.ccache
65-
- task: Bash@3
66-
displayName: Get CI scripts
67-
inputs:
68-
targetType: inline
69-
script: |
70-
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/install-package.sh
71-
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/build-package.sh
72-
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/test-package.sh
73-
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/set-branch.sh
74-
condition: and(succeeded(), not(canceled()))
75-
- task: Bash@3
76-
displayName: Set Branch
77-
inputs:
78-
targetType: inline
79-
script: |
80-
source ./set-branch.sh --branch=${SYSTEM_PULLREQUEST_TARGETBRANCH:-${BUILD_SOURCEBRANCH#refs/heads/}}
81-
echo "##vso[task.setvariable variable=BRANCH]$BRANCH"
82-
condition: and(succeeded(), not(canceled()))
83-
- task: DownloadSecureFile@1
84-
name: deployKey
85-
displayName: 'Download Deploy Key'
86-
inputs:
87-
secureFile: deploy_key
88-
condition: and(succeeded(), not(canceled()))
89-
- task: Bash@3
90-
displayName: Install
91-
env:
92-
SSH_KNOWN_HOSTS: "github.com"
93-
inputs:
94-
targetType: inline
95-
script: |
96-
mkdir -p "${HOME}"/.ssh
97-
cp $(deployKey.secureFilePath) "${HOME}"/.ssh/ci_ssh_key
98-
if [[ -n "${SSH_KNOWN_HOSTS}" ]]
99-
then
100-
for host in ${SSH_KNOWN_HOSTS}
101-
do
102-
echo -e "\e[35m\e[1mssh-keyscan -t rsa -H \"${host}\" 2>&1 | tee -a ${HOME}/.ssh/known_hosts\e[0m"
103-
ssh-keyscan -t rsa -H "${host}" 2>&1 | tee -a "${HOME}"/.ssh/known_hosts
104-
done
105-
fi
106-
bash install-package.sh --package=$PACKAGE --branch=$BRANCH --commit=$BUILD_SOURCEVERSION --pullrequest=${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER:-false} --image="ghcr.io/tue-robotics/tue-env-ros-noetic" --ssh --ssh-key="${HOME}"/.ssh/ci_ssh_key
107-
condition: and(succeeded(), not(canceled()))
108-
- task: Bash@3
109-
displayName: Build
110-
inputs:
111-
targetType: inline
112-
script: |
113-
bash build-package.sh --package=$PACKAGE
114-
condition: and(succeeded(), not(canceled()))
115-
- task: Bash@3
116-
displayName: Test
117-
inputs:
118-
targetType: inline
119-
script: |
120-
bash test-package.sh --package=$PACKAGE
121-
condition: and(succeeded(), not(canceled()))
55+
condition: and(succeeded(), not(canceled()), ne(stageDependencies.package_selection.outputs['package_selection.matrix.json_string'], '{}'))
56+
jobs:
57+
- job: "" # This lets the job name be just the name of the matrix key
58+
condition: and(succeeded(), not(canceled()))
59+
strategy:
60+
matrix: $[ stageDependencies.package_selection.package_selection.outputs['matrix.json_string'] ]
61+
steps:
62+
- task: Cache@2
63+
displayName: Cache ccache
64+
inputs:
65+
key: '$(Agent.OS) | ccache | $(System.TeamProject) | $(PACKAGE) | $(Build.SourceVersion)'
66+
restoreKeys: |
67+
$(Agent.OS) | ccache | $(System.TeamProject) | $(PACKAGE)
68+
$(Agent.OS) | ccache | $(System.TeamProject)
69+
$(Agent.OS) | ccache
70+
path: $(HOME)/.ccache
71+
- task: Cache@2
72+
displayName: Cache pip
73+
inputs:
74+
key: '$(Agent.OS) | pip | $(System.TeamProject) | $(PACKAGE) | $(Build.SourceVersion)'
75+
restoreKeys: |
76+
$(Agent.OS) | pip | $(System.TeamProject) | $(PACKAGE)
77+
$(Agent.OS) | pip | $(System.TeamProject)
78+
$(Agent.OS) | pip
79+
path: $(HOME)/.cache/pip
80+
- task: Bash@3
81+
displayName: Get CI scripts
82+
inputs:
83+
targetType: inline
84+
script: |
85+
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/install-package.sh
86+
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/build-package.sh
87+
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/test-package.sh
88+
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/set-branch.sh
89+
condition: and(succeeded(), not(canceled()))
90+
- task: Bash@3
91+
displayName: Set Branch
92+
inputs:
93+
targetType: inline
94+
script: |
95+
source ./set-branch.sh --branch=${SYSTEM_PULLREQUEST_TARGETBRANCH:-${BUILD_SOURCEBRANCH#refs/heads/}}
96+
echo "##vso[task.setvariable variable=BRANCH]$BRANCH"
97+
condition: and(succeeded(), not(canceled()))
98+
- task: DownloadSecureFile@1
99+
name: deployKey
100+
displayName: 'Download Deploy Key'
101+
inputs:
102+
secureFile: deploy_key
103+
condition: and(succeeded(), not(canceled()))
104+
- task: Bash@3
105+
displayName: Install
106+
env:
107+
SSH_KNOWN_HOSTS: "github.com"
108+
inputs:
109+
targetType: inline
110+
script: |
111+
mkdir -p "${HOME}"/.ssh
112+
cp $(deployKey.secureFilePath) "${HOME}"/.ssh/ci_ssh_key
113+
if [[ -n "${SSH_KNOWN_HOSTS}" ]]
114+
then
115+
for host in ${SSH_KNOWN_HOSTS}
116+
do
117+
echo -e "\e[35m\e[1mssh-keyscan -t rsa -H \"${host}\" 2>&1 | tee -a ${HOME}/.ssh/known_hosts\e[0m"
118+
ssh-keyscan -t rsa -H "${host}" 2>&1 | tee -a "${HOME}"/.ssh/known_hosts
119+
done
120+
fi
121+
bash install-package.sh --package=${PACKAGE} --branch=${BRANCH} --commit=${BUILD_SOURCEVERSION} --pullrequest=${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER:-false} --image="ghcr.io/tue-robotics/tue-env-ros-noetic"
122+
condition: and(succeeded(), not(canceled()))
123+
- task: Bash@3
124+
displayName: Build
125+
inputs:
126+
targetType: inline
127+
script: |
128+
bash build-package.sh --package=$PACKAGE
129+
condition: and(succeeded(), not(canceled()))
130+
- task: Bash@3
131+
displayName: Test
132+
inputs:
133+
targetType: inline
134+
script: |
135+
bash test-package.sh --package=$PACKAGE
136+
condition: and(succeeded(), not(canceled())

0 commit comments

Comments
 (0)