Skip to content

Commit

Permalink
ci: Move container registry authentication to an Azure Devops step
Browse files Browse the repository at this point in the history
This aims to
- Reduce duplication
- Seperate CI specific setup from test setup
- Prepare for migration from Azure DevOps to GitHub Actions
  • Loading branch information
moreati committed Sep 26, 2024
1 parent 2e2dfb1 commit b926795
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 49 deletions.
11 changes: 0 additions & 11 deletions .ci/ansible_install.py

This file was deleted.

17 changes: 13 additions & 4 deletions .ci/azure-pipelines-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ steps:
versionSpec: '$(python.version)'
condition: ne(variables['python.version'], '')

- script: |
set -o errexit
set -o nounset
set -o pipefail
aws ecr-public get-login-password | docker login --username AWS --password-stdin public.ecr.aws
displayName: Authenticate to container registry
condition: eq(variables['Agent.OS'], 'Linux')
env:
AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
AWS_DEFAULT_REGION: $(AWS_DEFAULT_REGION)

- script: |
set -o errexit
set -o nounset
Expand Down Expand Up @@ -90,7 +103,3 @@ steps:
"$PYTHON" -m tox -e "$(tox.env)"
displayName: "Run tests"
env:
AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
AWS_DEFAULT_REGION: $(AWS_DEFAULT_REGION)
3 changes: 0 additions & 3 deletions .ci/debops_common_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
[
'python -m pip --no-python-version-warning --disable-pip-version-check "debops[ansible]==2.1.2"',
],
[
'if [ "${TF_BUILD:-false}" = "True" ]; then aws ecr-public get-login-password | docker login --username AWS --password-stdin public.ecr.aws; fi',
],
])

ci_lib.run('ansible-galaxy collection install debops.debops:==2.1.2')
8 changes: 0 additions & 8 deletions .ci/localhost_ansible_install.py

This file was deleted.

14 changes: 0 additions & 14 deletions .ci/mitogen_install.py

This file was deleted.

3 changes: 0 additions & 3 deletions .ci/mitogen_py24_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import ci_lib

batches = [
[
'if [ "${TF_BUILD:-false}" = "True" ]; then aws ecr-public get-login-password | docker login --username AWS --password-stdin public.ecr.aws; fi',
],
[
'curl https://dw.github.io/mitogen/binaries/ubuntu-python-2.4.6.tar.bz2 | sudo tar -C / -jxv',
]
Expand Down
6 changes: 0 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,14 @@ deps =
install_command =
python -m pip --no-python-version-warning --disable-pip-version-check install {opts} {packages}
commands_pre =
mode_ansible: {toxinidir}/.ci/ansible_install.py
mode_debops_common: {toxinidir}/.ci/debops_common_install.py
mode_localhost: {toxinidir}/.ci/localhost_ansible_install.py
mode_mitogen: {toxinidir}/.ci/mitogen_install.py
commands =
mode_ansible: {toxinidir}/.ci/ansible_tests.py
mode_debops_common: {toxinidir}/.ci/debops_common_tests.py
mode_localhost: {toxinidir}/.ci/localhost_ansible_tests.py
mode_mitogen: {toxinidir}/.ci/mitogen_tests.py
passenv =
ANSIBLE_*
AWS_ACCESS_KEY_ID
AWS_DEFAULT_REGION
AWS_SECRET_ACCESS_KEY
HOME
# Azure DevOps, TF_BUILD is set to 'True' when running in a build task
# https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables
Expand Down

0 comments on commit b926795

Please sign in to comment.