Skip to content

Update Molecule AMIs used for Tests #462

Update Molecule AMIs used for Tests

Update Molecule AMIs used for Tests #462

---
name: Update Molecule AMIs used for Tests
on:
schedule:
# * is a special character in YAML, so you have to quote this string
# Run once a day
- cron: '0 0 * * *'
permissions:
contents: write
id-token: write
pull-requests: write
jobs:
updatecli:
runs-on: ubuntu-latest
strategy:
matrix:
platforms:
- os: alma
architecture: x86_64
image_name: "AlmaLinux OS 8*"
owner_id: "764336703387"
variant: "8"
- os: alma
architecture: x86_64
image_name: "AlmaLinux OS 9*"
owner_id: "764336703387"
variant: "9"
- os: amazon
architecture: x86_64
image_name: amzn2*
owner_id: "137112412989"
variant: "2"
- os: amazon
architecture: x86_64
image_name: al2023-ami*
owner_id: "137112412989"
variant: "2023"
- os: centos
architecture: x86_64
image_name: "CentOS Linux 7 x86_64*"
owner_id: "125523088429"
variant: "7"
- os: centos
architecture: x86_64
image_name: "CentOS Stream 8 x86_64*"
owner_id: "125523088429"
variant: "8"
- os: centos
architecture: arm64
image_name: "CentOS Stream 8 aarch64*"
owner_id: "125523088429"
variant: "8"
- os: debian
architecture: x86_64
image_name: "debian-10-amd64*"
owner_id: "136693071363"
variant: "10"
- os: debian
architecture: x86_64
image_name: "debian-11-amd64*"
owner_id: "136693071363"
variant: "11"
- os: debian
architecture: x86_64
image_name: "debian-12-amd64*"
owner_id: "136693071363"
variant: "12"
- os: rocky
architecture: x86_64
image_name: "Rocky-8-EC2-Base*"
owner_id: "792107900819"
variant: "8"
- os: rocky
architecture: x86_64
image_name: "Rocky-9-EC2-Base*"
owner_id: "792107900819"
variant: "9"
- os: ubuntu
architecture: x86_64
image_name: ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server*
owner_id: "099720109477"
variant: "1804"
- os: ubuntu
architecture: x86_64
image_name: ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server*
owner_id: "099720109477"
variant: "2004"
- os: ubuntu
architecture: x86_64
image_name: ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server*
owner_id: "099720109477"
variant: "2204"
- os: ubuntu
architecture: arm64
image_name: ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-arm64-server*
owner_id: "099720109477"
variant: "2204"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Updatecli in the runner
uses: updatecli/[email protected]
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.DRAIOS_GH_ACTIONS_ANSIBLE_MOLECULE_ROLE_ARN }}
aws-region: ${{ secrets.REGION }}
- name: Substitute matrix vars
run: |
cat .github/updatecli.d/config.yaml.template | envsubst > .github/updatecli.d/config-${{ matrix.platforms.os }}-${{ matrix.platforms.variant }}-${{ matrix.platforms.architecture }}.yaml
env:
VARIANT: ${{ matrix.platforms.variant }}
REGION: ${{ secrets.REGION }}
OS: ${{ matrix.platforms.os }}
ARCHITECTURE: ${{ matrix.platforms.architecture }}
OWNER_ID: ${{ matrix.platforms.owner_id }}
IMAGE_NAME: ${{ matrix.platforms.image_name }}
- name: Run updatecli in apply mode
run: |
for scenario in $(find . -name "molecule.yml.template" -type f | sed 's/^.\///g');
do
scenario_name=$(basename $(dirname $scenario))
export SCENARIO_CONFIG=$scenario
export SCENARIO_NAME=$scenario_name
updatecli apply --config .github/updatecli.d/config-${{ matrix.platforms.os }}-${{ matrix.platforms.variant }}-${{ matrix.platforms.architecture }}.yaml
done
env:
GITHUB_TOKEN: "${{ secrets.TOOLS_JENKINS_ADMIN_ACCESS_GITHUB_TOKEN }}"