mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-06-21 16:24:32 +00:00
Currently the pipeline used to create test containers is using Python 3.6.15, and Ansible 2.12 requires, at least, Python 3.8. This change adds a new parameter to build container template, `python_version`, which is set by default to '3.x', meaning it will use the latest Python version available (for version 3) if the parameter is not explicitly set.
41 lines
1.3 KiB
YAML
41 lines
1.3 KiB
YAML
---
|
|
parameters:
|
|
- name: job_name_suffix
|
|
type: string
|
|
- name: container_name
|
|
type: string
|
|
- name: build_scenario_name
|
|
type: string
|
|
- name: python_version
|
|
type: string
|
|
default: 3.x
|
|
|
|
jobs:
|
|
- job: BuildTestImage${{ parameters.job_name_suffix }}
|
|
displayName: Build ${{ parameters.container_name }} test container
|
|
steps:
|
|
- task: UsePythonVersion@0
|
|
inputs:
|
|
versionSpec: '${{ parameters.python_version }}'
|
|
|
|
- script: python -m pip install --upgrade pip setuptools wheel ansible
|
|
displayName: Install tools
|
|
|
|
- script: pip install molecule[docker]
|
|
displayName: Install molecule
|
|
|
|
- script: molecule create -s ${{ parameters.build_scenario_name }}
|
|
displayName: Create test container
|
|
env:
|
|
ANSIBLE_LIBRARY: ./molecule
|
|
|
|
- script: |
|
|
docker stop ${{ parameters.build_scenario_name }}
|
|
docker commit ${{ parameters.build_scenario_name }} quay.io/ansible-freeipa/upstream-tests:${{ parameters.container_name }}
|
|
docker login -u="$QUAY_ROBOT_USERNAME" -p="$QUAY_ROBOT_TOKEN" quay.io
|
|
docker push quay.io/ansible-freeipa/upstream-tests:${{ parameters.container_name }}
|
|
displayName: Save image and upload
|
|
env:
|
|
# Secrets needs to be mapped as env vars to work properly
|
|
QUAY_ROBOT_TOKEN: $(QUAY_ROBOT_TOKEN)
|