Skip to content

Bump brace-expansion in /assets #2713

Bump brace-expansion in /assets

Bump brace-expansion in /assets #2713

Workflow file for this run

# SPDX-FileCopyrightText: SUSE LLC
# SPDX-License-Identifier: Apache-2.0
name: Pull request environment cleanup
on:
pull_request:
types:
- closed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PR_ENV_LABEL: env
PR_NUMBER: "${{ github.event.pull_request.number }}"
ANSIBLE_CORE_VERSION: "2.16.3" # https://pypi.org/project/ansible-core/#history
jobs:
check_env_creation_privilege:
name: Check if the environment deletion criteria are met, store in the job output
runs-on: ubuntu-24.04
outputs:
create_env: ${{ steps.check.outputs.create_env }}
steps:
- id: check
run: echo "create_env=${{ contains(github.event.pull_request.labels.*.name, env.PR_ENV_LABEL) }}" >> "$GITHUB_OUTPUT"
remove_pr_comment:
name: Comment on the pull request
runs-on: ubuntu-24.04
needs: check_env_creation_privilege
if: needs.check_env_creation_privilege.outputs.create_env == 'true'
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Comment on the pull request
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { onPrEnvClosed } = require('.github/scripts/pr_env.js')(github, context);
onPrEnvClosed().catch(console.error);
delete-pr-image:
needs: check_env_creation_privilege
name: Build and push pull request container image
runs-on: ubuntu-24.04
if: needs.check_env_creation_privilege.outputs.create_env == 'true'
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_TAG: ${{ github.event.pull_request.number }}-env
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4
- name: Log in to the Container registry
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Delete the container image
uses: bots-house/ghcr-delete-image-action@3827559c68cb4dcdf54d813ea9853be6d468d3a4 # v1.1.0
with:
owner: ${{ github.repository_owner }}
name: trento-web
tag: ${{ env.IMAGE_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}
delete_pr_environment:
name: Delete the pr environment
runs-on: ubuntu-24.04
needs: delete-pr-image
steps:
- name: Checkout ansible repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: trento-project/ansible
path: ansible
- name: Add pipx_bin to path
if: ${{ env.ACT }}
run: echo '/opt/pipx_bin' >> $GITHUB_PATH
- name: Install ansible-core
run: sudo pipx install --force ansible-core==${{ env.ANSIBLE_CORE_VERSION }}
- name: Install galaxy deps
run: ansible-galaxy install -r ansible/requirements.yml
- name: Run playbook
uses: dawidd6/action-ansible-playbook@126642a1c6ce512da255ef2b41e8ee90f0077474 # v9
with:
playbook: ansible/playbook.cleanup.yml
key: ${{ secrets.SSH_PR_MACHINE_KEY }}
inventory: |
all:
vars:
ansible_user: ec2-user
ansible_python_interpreter: /usr/bin/python3
trento_server_name: '${{ env.PR_BASE_URL }}'
trento_web_postgres_username: '${{ env.PR_NUMBER }}web'
trento_web_postgres_password: 'trento'
trento_web_postgres_db: '${{ env.PR_NUMBER }}db'
trento_web_postgres_event_store: '${{ env.PR_NUMBER }}edb'
trento_wanda_postgres_username: '${{ env.PR_NUMBER }}wanda'
trento_wanda_postgres_password: 'wanda'
trento_wanda_postgres_db: '${{ env.PR_NUMBER }}wandadb'
trento_rabbitmq_username: '${{ env.PR_NUMBER }}rabbitusr'
trento_rabbitmq_password: 'trento'
trento_rabbitmq_vhost: '${{ env.PR_NUMBER }}'
rproxy_vhost_filename: '${{ env.PR_NUMBER }}'
children:
trento_server:
hosts:
server:
ansible_host: ${{ secrets.PR_ENV_MACHINE_IP }}
postgres_hosts:
hosts:
server:
ansible_host: ${{ secrets.PR_ENV_MACHINE_IP }}
rabbitmq_hosts:
hosts:
server:
ansible_host: ${{ secrets.PR_ENV_MACHINE_IP }}
prometheus_hosts:
hosts:
server:
ansible_host: ${{ secrets.PR_ENV_MACHINE_IP }}
options: |
--extra-vars "trento_install_method='docker' \
trento_docker_network_name='${{ env.PR_NUMBER }}net' \
trento_web_container_name='${{ env.PR_NUMBER }}web' \
web_container_image='ghcr.io/trento-project/trento-web:${{ env.PR_NUMBER }}-env' \
wanda_container_name='${{ env.PR_NUMBER }}wanda' \
wanda_checks_container_name='${{ env.PR_NUMBER }}checks' \
wanda_remove_wanda_container_image=false \
wanda_remove_checks_container_image=false"