Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

[7.17](backport #2163) chore: decouple ansible install from execution #2166

Merged
merged 1 commit into from
Feb 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 25 additions & 12 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -351,18 +351,31 @@ def pyrun(command){
[var: "AWS_ACCESS_KEY_ID", password: awsAuthObj.access_key],
[var: "AWS_SECRET_ACCESS_KEY", password: awsAuthObj.secret_key]
]) {
sh(script: """#!/bin/bash
set -eux
if ! test -d ${env.WORKSPACE}/.venv; then
python3 -m venv ${env.WORKSPACE}/.venv
${env.WORKSPACE}/.venv/bin/pip3 -q install wheel
${env.WORKSPACE}/.venv/bin/pip3 -q install -r .ci/ansible/requirements.txt
${env.WORKSPACE}/.venv/bin/ansible-galaxy install -r .ci/ansible/requirements.yml
fi
${env.WORKSPACE}/.venv/bin/${command}
""",
label: "Executing ${command.split(' ')[0]}"
)
retryWithSleep(retries: 3, seconds: 5, backoff: true){
sh(script: """#!/bin/bash
set -eux
if ! test -f ${env.WORKSPACE}/.venv-installed; then
python3 -m venv ${env.WORKSPACE}/.venv
touch ${env.WORKSPACE}/.venv-installed
fi
""",
label: "Creating virtualenv"
)
}
retryWithSleep(retries: 3, seconds: 30, backoff: true){
sh(script: """#!/bin/bash
set -eux
if ! test -f ${env.WORKSPACE}/.python-dependencies; then
${env.WORKSPACE}/.venv/bin/pip3 -q install wheel
${env.WORKSPACE}/.venv/bin/pip3 -q install -r .ci/ansible/requirements.txt
${env.WORKSPACE}/.venv/bin/ansible-galaxy install -r .ci/ansible/requirements.yml
touch ${env.WORKSPACE}/.python-dependencies
fi
""",
label: "Installing dependencies"
)
}
sh(script: "${env.WORKSPACE}/.venv/bin/${command}", label: "Executing ${command.split(' ')[0]}")
}
}
}
Expand Down