Skip to content

Commit

Permalink
Merge branch 'master' into azure_ssh
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthijsBurgh authored Apr 7, 2023
2 parents 3f96bce + 28c86ed commit 339c75d
Showing 1 changed file with 116 additions and 101 deletions.
217 changes: 116 additions & 101 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,111 +11,126 @@ schedules:
variables:
CI: true

jobs:
- job: package_selection
${{ if eq(variables['Build.Reason'], 'PullRequest')}}:
displayName: Package selection (PR)
${{ else }}:
displayName: Package selection
pool:
vmImage: ubuntu-latest
pool:
vmImage: ubuntu-latest

stages:
- stage: package_selection
displayName: Package selection
condition: and(succeeded(), not(canceled()))
steps:
- task: Bash@3
displayName: Get CI scripts
inputs:
targetType: inline
script: |
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/packages.sh
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/azure_commit_range.py
- task: Bash@3
displayName: Determine packages to be build
name: matrix
inputs:
targetType: inline
script: |
COMMIT_RANGE=$(python3 ./azure_commit_range.py)
BRANCH=${SYSTEM_PULLREQUEST_TARGETBRANCH:-${BUILD_SOURCEBRANCH#refs/heads/}}
DEFAULT_BRANCH=$(git remote show origin 2>/dev/null | grep HEAD | awk '{print $3}')
ALL=$(([ "$BUILD_REASON" == "Schedule" ] || (([ "$BUILD_REASON" == "BatchedCI" ] || [ "$BUILD_REASON" == "IndividualCI" ] || [ "$BUILD_REASON" == "Manual" ]) && [ "$BRANCH" == "$DEFAULT_BRANCH" ])) && echo "true")
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
echo "##vso[task.setVariable variable=json_string;isOutput=true]$PACKAGES_DICT"
jobs:
- job: package_selection
${{ if eq(variables['Build.Reason'], 'PullRequest')}}:
displayName: Package selection (PR)
${{ else }}:
displayName: Package selection
condition: and(succeeded(), not(canceled()))
steps:
- task: Bash@3
displayName: Get CI scripts
inputs:
targetType: inline
script: |
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/packages.sh
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/azure_commit_range.py
- task: Bash@3
displayName: Determine packages to be build
name: matrix
inputs:
targetType: inline
script: |
COMMIT_RANGE=$(python3 ./azure_commit_range.py)
BRANCH=${SYSTEM_PULLREQUEST_TARGETBRANCH:-${BUILD_SOURCEBRANCH#refs/heads/}}
DEFAULT_BRANCH=$(git remote show origin 2>/dev/null | grep HEAD | awk '{print $3}')
ALL=$(([ "$BUILD_REASON" == "Schedule" ] || (([ "$BUILD_REASON" == "BatchedCI" ] || [ "$BUILD_REASON" == "IndividualCI" ] || [ "$BUILD_REASON" == "Manual" ]) && [ "$BRANCH" == "$DEFAULT_BRANCH" ])) && echo "true")
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
echo "##vso[task.setVariable variable=json_string;isOutput=true]$PACKAGES_DICT"
- job: install_build_test
- stage: install_build_test
${{ if eq(variables['Build.Reason'], 'PullRequest')}}:
displayName: 'Install, build & test (PR):'
${{ else }}:
displayName: 'Install, build & test:'
pool:
vmImage: ubuntu-latest
dependsOn: package_selection
condition: and(succeeded(), not(canceled()), ne(dependencies.package_selection.outputs['matrix.json_string'], '{}'))
strategy:
matrix: $[ dependencies.package_selection.outputs['matrix.json_string'] ]
steps:
- task: Cache@2
displayName: Cache ccache
inputs:
key: '"$(Agent.OS)" | ccache | "$(System.TeamProject)" | $(PACKAGE) | "$(Build.SourceVersion)"'
restoreKeys: |
"$(Agent.OS)" | ccache | "$(System.TeamProject)" | $(PACKAGE)
"$(Agent.OS)" | ccache | "$(System.TeamProject)"
"$(Agent.OS)" | ccache
path: $(HOME)/.ccache
- task: Bash@3
displayName: Get CI scripts
inputs:
targetType: inline
script: |
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/install-package.sh
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/build-package.sh
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/test-package.sh
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/set-branch.sh
condition: and(succeeded(), not(canceled()))
- task: Bash@3
displayName: Set Branch
inputs:
targetType: inline
script: |
source ./set-branch.sh --branch=${SYSTEM_PULLREQUEST_TARGETBRANCH:-${BUILD_SOURCEBRANCH#refs/heads/}}
echo "##vso[task.setvariable variable=BRANCH]$BRANCH"
condition: and(succeeded(), not(canceled()))
- task: DownloadSecureFile@1
name: deployKey
displayName: 'Download Deploy Key'
inputs:
secureFile: deploy_key
condition: and(succeeded(), not(canceled()))
- task: Bash@3
displayName: Install
env:
SSH_KNOWN_HOSTS: "github.com"
inputs:
targetType: inline
script: |
mkdir -p "${HOME}"/.ssh
cp $(deployKey.secureFilePath) "${HOME}"/.ssh/ci_ssh_key
if [[ -n "${SSH_KNOWN_HOSTS}" ]]
then
for host in ${SSH_KNOWN_HOSTS}
do
echo -e "\e[35m\e[1mssh-keyscan -t rsa -H \"${host}\" 2>&1 | tee -a ${HOME}/.ssh/known_hosts\e[0m"
ssh-keyscan -t rsa -H "${host}" 2>&1 | tee -a "${HOME}"/.ssh/known_hosts
done
fi
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
condition: and(succeeded(), not(canceled()))
- task: Bash@3
displayName: Build
inputs:
targetType: inline
script: |
bash build-package.sh --package=$PACKAGE
condition: and(succeeded(), not(canceled()))
- task: Bash@3
displayName: Test
inputs:
targetType: inline
script: |
bash test-package.sh --package=$PACKAGE
condition: and(succeeded(), not(canceled()))
condition: and(succeeded(), not(canceled()), ne(stageDependencies.package_selection.outputs['package_selection.matrix.json_string'], '{}'))
jobs:
- job: "" # This lets the job name be just the name of the matrix key
condition: and(succeeded(), not(canceled()))
strategy:
matrix: $[ stageDependencies.package_selection.package_selection.outputs['matrix.json_string'] ]
steps:
- task: Cache@2
displayName: Cache ccache
inputs:
key: '$(Agent.OS) | ccache | $(System.TeamProject) | $(PACKAGE) | $(Build.SourceVersion)'
restoreKeys: |
$(Agent.OS) | ccache | $(System.TeamProject) | $(PACKAGE)
$(Agent.OS) | ccache | $(System.TeamProject)
$(Agent.OS) | ccache
path: $(HOME)/.ccache
- task: Cache@2
displayName: Cache pip
inputs:
key: '$(Agent.OS) | pip | $(System.TeamProject) | $(PACKAGE) | $(Build.SourceVersion)'
restoreKeys: |
$(Agent.OS) | pip | $(System.TeamProject) | $(PACKAGE)
$(Agent.OS) | pip | $(System.TeamProject)
$(Agent.OS) | pip
path: $(HOME)/.cache/pip
- task: Bash@3
displayName: Get CI scripts
inputs:
targetType: inline
script: |
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/install-package.sh
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/build-package.sh
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/test-package.sh
wget https://raw.githubusercontent.com/tue-robotics/tue-env/master/ci/set-branch.sh
condition: and(succeeded(), not(canceled()))
- task: Bash@3
displayName: Set Branch
inputs:
targetType: inline
script: |
source ./set-branch.sh --branch=${SYSTEM_PULLREQUEST_TARGETBRANCH:-${BUILD_SOURCEBRANCH#refs/heads/}}
echo "##vso[task.setvariable variable=BRANCH]$BRANCH"
condition: and(succeeded(), not(canceled()))
- task: DownloadSecureFile@1
name: deployKey
displayName: 'Download Deploy Key'
inputs:
secureFile: deploy_key
condition: and(succeeded(), not(canceled()))
- task: Bash@3
displayName: Install
env:
SSH_KNOWN_HOSTS: "github.com"
inputs:
targetType: inline
script: |
mkdir -p "${HOME}"/.ssh
cp $(deployKey.secureFilePath) "${HOME}"/.ssh/ci_ssh_key
if [[ -n "${SSH_KNOWN_HOSTS}" ]]
then
for host in ${SSH_KNOWN_HOSTS}
do
echo -e "\e[35m\e[1mssh-keyscan -t rsa -H \"${host}\" 2>&1 | tee -a ${HOME}/.ssh/known_hosts\e[0m"
ssh-keyscan -t rsa -H "${host}" 2>&1 | tee -a "${HOME}"/.ssh/known_hosts
done
fi
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"
condition: and(succeeded(), not(canceled()))
- task: Bash@3
displayName: Build
inputs:
targetType: inline
script: |
bash build-package.sh --package=$PACKAGE
condition: and(succeeded(), not(canceled()))
- task: Bash@3
displayName: Test
inputs:
targetType: inline
script: |
bash test-package.sh --package=$PACKAGE
condition: and(succeeded(), not(canceled())

0 comments on commit 339c75d

Please sign in to comment.