Skip to content

CI: pwsh_uninstall #279

CI: pwsh_uninstall

CI: pwsh_uninstall #279

name: "CI: pwsh_uninstall"
on:
schedule:
- cron: '30 3 * * *'
push:
paths:
- 'molecule/pwsh_uninstall/**'
- 'powershell/install/**'
- '.github/workflows/pwsh_uninstall.yml'
pull_request_target:
types: [ labeled ]
paths:
- 'molecule/pwsh_uninstall/**'
- 'powershell/install/**'
- '.github/workflows/pwsh_uninstall.yml'
jobs:
molecule:
if: |
github.event_name == 'push' ||
github.event_name == 'schedule' ||
(github.event_name == 'pull_request_target' &&
github.event.label.name == 'ok-to-test')
name: ${{ matrix.molecule.distro }}-${{ matrix.collection_role }}
runs-on: ubuntu-latest
env:
PY_COLORS: 1
ANSIBLE_FORCE_COLOR: 1
FALCON_CLIENT_ID: ${{ secrets.FALCON_CLIENT_ID }}
FALCON_CLIENT_SECRET: ${{ secrets.FALCON_CLIENT_SECRET }}
FALCON_CLOUD: ${{ secrets.FALCON_CLOUD }}
FALCON_CID: ${{ secrets.FALCON_CID }}
FALCON_PROV_TOKEN: ${{ secrets.FALCON_PROV_TOKEN }}
AWS_REGION: "us-west-1"
MOLECULE_VPC_SUBNET_ID: ${{ secrets.MOLECULE_VPC_SUBNET_ID }}
permissions:
contents: read
id-token: write
strategy:
fail-fast: false
matrix:
molecule:
- distro: WindowsServer2022
image_owner: 801119661308
image_arch: x86_64
image_name: Windows_Server-2022-English-Full-Base-*
instance_type: t3a.medium
collection_role:
- pwsh_uninstall
steps:
- name: Check out code
uses: actions/checkout@v4
if: github.event_name != 'pull_request_target'
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.sha}}
if: github.event_name == 'pull_request_target'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_OIDC_ROLE }}
role-session-name: github-actions-molecule-ansible
aws-region: ${{ env.AWS_REGION }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: '.github/workflows/pwsh_uninstall.yml'
- name: Install dependencies
run: |
sudo apt install apt-transport-https ca-certificates curl software-properties-common libssl-dev
python -m pip install --upgrade pip
pip install molecule "molecule-plugins[ec2]" ansible ansible-core==2.16.7 ansible-lint boto3 botocore pywinrm
- name: Run role tests
id: molecule-role-test
uses: nick-fields/retry@v3
env:
MOLECULE_INSTANCE_NAME: ${{ matrix.molecule.distro }}-${{ matrix.collection_role }}
MOLECULE_IMAGE_OWNER: ${{ matrix.molecule.image_owner }}
MOLECULE_IMAGE_ARCH: ${{ matrix.molecule.image_arch }}
MOLECULE_IMAGE_NAME: '${{ matrix.molecule.image_name }}'
MOLECULE_INSTANCE_TYPE: ${{ matrix.molecule.instance_type }}
MOLECULE_REGION: ${{ env.AWS_REGION}}
with:
timeout_minutes: 15
max_attempts: 3
retry_on: error
command: >-
molecule --version &&
ansible --version &&
molecule --debug test --destroy never -s ${{ matrix.collection_role }}
continue-on-error: true
- name: Ensure instances are destroyed
uses: nick-fields/retry@v3
env:
MOLECULE_INSTANCE_NAME: ${{ matrix.molecule.distro }}-${{ matrix.collection_role }}
MOLECULE_IMAGE_OWNER: ${{ matrix.molecule.image_owner }}
MOLECULE_IMAGE_ARCH: ${{ matrix.molecule.image_arch }}
MOLECULE_IMAGE_NAME: '${{ matrix.molecule.image_name }}'
MOLECULE_INSTANCE_TYPE: ${{ matrix.molecule.instance_type }}
MOLECULE_REGION: ${{ env.AWS_REGION}}
with:
timeout_minutes: 10
max_attempts: 3
retry_on: error
command: >-
molecule --version &&
ansible --version &&
molecule --debug destroy -s ${{ matrix.collection_role }}
- name: Assert molecule tests passed
uses: nick-fields/assert-action@v2
with:
expected: success
actual: ${{ steps.molecule-role-test.outcome }}