Skip to content

Convert uyuni traditionnal to uyuni podman and rename modules uyuni CI NUE #714

Convert uyuni traditionnal to uyuni podman and rename modules uyuni CI NUE

Convert uyuni traditionnal to uyuni podman and rename modules uyuni CI NUE #714

name: Sumaform validation
on:
pull_request:
paths:
- 'terracumber_config/tf_files/**'
jobs:
validate_sumaform:
name: Validate sumaform files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: tf_files
name: Get modified .tf files
uses: Ana06/[email protected]
with:
filter: '*.tf'
- name: Install terraform
if: steps.tf_files.outputs.added_modified
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.0.10
- name: Checkout sumaform
if: steps.tf_files.outputs.added_modified
uses: actions/checkout@v4
with:
repository: uyuni-project/sumaform
path: sumaform
- name: Download Feilong terraform provider asset
if: steps.tf_files.outputs.added_modified
uses: robinraju/[email protected]
with:
repository: Bischoff/terraform-provider-feilong
tag: v0.0.6
fileName: terraform-provider-feilong_0.0.6_linux_amd64.tar.gz
extract: true
- name: Validate files
if: steps.tf_files.outputs.added_modified
env:
TF_VAR_SCC_USER: "user"
TF_VAR_SCC_PASSWORD: "password"
TF_VAR_MIRROR: ""
TF_VAR_PULL_REQUEST_REPO: ""
TF_VAR_MASTER_REPO: ""
TF_VAR_MASTER_OTHER_REPO: ""
TF_VAR_MASTER_SUMAFORM_TOOLS_REPO: ""
TF_VAR_UPDATE_REPO: ""
TF_VAR_ADDITIONAL_REPO_URL: ""
TF_VAR_TEST_PACKAGES_REPO: ""
TF_VAR_SLE_CLIENT_REPO: ""
TF_VAR_RHLIKE_CLIENT_REPO: ""
TF_VAR_DEBLIKE_CLIENT_REPO: ""
TF_VAR_OPENSUSE_CLIENT_REPO: ""
TF_VAR_ZVM_ADMIN_TOKEN: ""
TF_VAR_CONTAINER_REPOSITORY: ""
run: |
# Install feilong provider
srcdir=/home/runner/work/susemanager-ci/susemanager-ci/
dstdir=/usr/share/terraform/plugins/registry.terraform.io/bischoff/feilong/0.0.4/linux_amd64/
sudo mkdir -p $dstdir
sudo ln -s $srcdir/terraform-provider-feilong $dstdir
# Remove libvirt and feilong provider settings
sed -i \
-e '/provider *"/,/^[ \/#]*\}\s*$/d' \
-e '/libvirt = {/,/^[ \/#]*\}\s*$/d' \
-e '/libvirt =/d' \
-e '/feilong = {/,/^[ \/#]*\}\s*$/d' \
-e '/feilong =/d' \
${{steps.tf_files.outputs.added_modified}}
# Also exclude s390 minions from terraform plan
sed -i \
-e '/^module ".*s390.*" {$/,/^}$/d' \
-e '/.*s390.*_configuration *= module.*s390.*\.configuration/d' \
${{steps.tf_files.outputs.added_modified}}
# Setup sumaform with the 'null' backend
cd sumaform
ln -sfn ../backend_modules/null modules/backend
# Provide a fake private SSH key
mkdir -p ~/.ssh
touch ~/.ssh/id_rsa
for tf_file in ${{steps.tf_files.outputs.added_modified}}; do
echo "::notice::Validating '`basename $tf_file`'..."
cp ../$tf_file main.tf
# Uncomment for Terraform detailed logging
# export TF_LOG=trace
terraform init -input=false
terraform validate
terraform plan -input=false
echo
done