Remote RHEL Build #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Remote RHEL Build | |
on: | |
workflow_dispatch: | |
env: | |
AWS_REGION: us-east-1 | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
TF_VAR_vpc_id: ${{ secrets.VPC_ID }} | |
TF_VAR_rh_access: ${{ secrets.RH_ACCESS }} | |
TF_VAR_rh_org: ${{ secrets.RH_ORG }} | |
TF_VAR_ami_id: ${{ secrets.AMI_ID }} | |
jobs: | |
podman-remote: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: hashicorp/setup-terraform@v3 | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: sshkeygen for ansible | |
run: ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N "" | |
- name: Terraform Init | |
run: terraform init | |
- name: Terraform Apply | |
run: terraform apply -auto-approve | |
- name: Install podman remote | |
run: | | |
sudo apt-get install -y podman podman-remote | |
sudo apt-get install -y jq | |
- name: jq parse the terraform state for the public ip | |
run: | | |
PUBLIC_IP=$(terraform output -json | jq -r '.public_ip.value') | |
podman system connection add terraform --identity ~/.ssh/id_rsa ssh://ec2-user@$PUBLIC_IP/run/user/1000/podman/podman.sock | |
podman system connection list | |
- name: Build image | |
run: | | |
podman-remote build -f build/docker/builder/cpu/rhel9/Containerfile . | |
- name: Terraform Destroy | |
if: always() | |
run: terraform destroy -auto-approve |