|
| 1 | +--- |
| 2 | +name: test-ipa-keycloak-with-action |
| 3 | +run-name: Run local FreeIPA tests using a Github Action |
| 4 | +on: |
| 5 | + push: |
| 6 | + # branches: |
| 7 | + # - main |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + test-ipa-keycloak: |
| 15 | + runs-on: ubuntu-24.04 |
| 16 | + steps: |
| 17 | + - name: Clone the repository |
| 18 | + uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Create environment with FreeIPA-Cluster-Test |
| 21 | + |
| 22 | + with: |
| 23 | + cluster_configuration: ipalab-config/ipa-keycloak/lab_ipa_keycloak.yml |
| 24 | + shutdown: false |
| 25 | + |
| 26 | + - name: Trust Keycloak certificate |
| 27 | + shell: bash |
| 28 | + run: keycloak/trust_keycloak.sh server |
| 29 | + |
| 30 | + - name: Add Keycloak OIDC client |
| 31 | + shell: bash |
| 32 | + run: keycloak/keycloak_add_oidc_client.sh server.ipa.test ipa_oidc_client Secret123 |
| 33 | + |
| 34 | + - name: Create Keycloak user |
| 35 | + shell: bash |
| 36 | + run: keycloak/keycloak_add_user.sh jdoe [email protected] userPASS |
| 37 | + |
| 38 | + - name: Configure Keycloak as an IPA IDP endpoint |
| 39 | + shell: bash |
| 40 | + run: ansible-playbook -i inventory.yml playbooks/idp_keycloak.yml |
| 41 | + |
| 42 | + - name: "Add user with 'auth-type: idp'" |
| 43 | + shell: bash |
| 44 | + run: ansible-playbook -i inventory.yml playbooks/add_user_auth_idp.yml |
| 45 | + |
| 46 | + # |
| 47 | + # The comments below are yet to be implemented as the actual login |
| 48 | + # requires the access of a one-time link and typing in the console. |
| 49 | + # |
| 50 | + |
| 51 | + # - name: Login user jdoe in Keycloak |
| 52 | + |
| 53 | + # - name: Authorize ipa_oidc_client device authentication for user jdoe |
| 54 | + |
| 55 | + # - name: Authenticate jdoe on IPA |
| 56 | + # shell: bash |
| 57 | + # run: | |
| 58 | + # podman exec server kinit -n -c /fast.ccache |
| 59 | + # podman exec -it server kinit -T /fast.ccache jdoe |
| 60 | + # # Retrieve login link |
| 61 | + # # Authorize login within keycloak |
| 62 | + # # Send ENTER to shell |
| 63 | + |
| 64 | + - name: Shutdown environment |
| 65 | + |
| 66 | + with: |
| 67 | + cluster_configuration: ipalab-config/ipa-keycloak/lab_ipa_keycloak.yml |
| 68 | + shutdown: true |
| 69 | + |
| 70 | + minimal-demo: |
| 71 | + runs-on: ubuntu-24.04 |
| 72 | + steps: |
| 73 | + - name: Clone the repository |
| 74 | + uses: actions/checkout@v4 |
| 75 | + |
| 76 | + - name: Build image |
| 77 | + id: build-image |
| 78 | + uses: redhat-actions/buildah-build@v2 |
| 79 | + with: |
| 80 | + image: ipalab-minimal-demo |
| 81 | + tags: latest |
| 82 | + containerfiles: ipalab-config/minimal/Containerfile.minimal |
| 83 | + |
| 84 | + - name: Create environment and record a demo |
| 85 | + |
| 86 | + with: |
| 87 | + cluster_configuration: ipalab-config/minimal/minimal.yaml |
| 88 | + |
| 89 | + - name: Collect server logs in case of a test failure |
| 90 | + shell: bash |
| 91 | + if: failure() |
| 92 | + run: | |
| 93 | + podman exec -ti dc.minimal.test ls -laR /var/log |
| 94 | + mkdir -p CONFIG_DIR/results |
| 95 | + podman exec -ti dc.minimal.test dnf -y install sos |
| 96 | + podman exec -ti dc.minimal.test sos report \ |
| 97 | + --profile={identity,webserver,security,system,network} \ |
| 98 | + -a --all-logs --batch |
| 99 | + podman exec dc.minimal.test sh -c 'ls /var/tmp/sosreport*' | while read f ; do |
| 100 | + podman cp dc.minimal.test:$f CONFIG_DIR/results/ |
| 101 | + done |
| 102 | +
|
| 103 | + - name: Upload server logs |
| 104 | + uses: actions/upload-artifact@v4 |
| 105 | + if: failure() |
| 106 | + with: |
| 107 | + name: server-logs |
| 108 | + path: CONFIG_DIR/results/sosreport* |
| 109 | + if-no-files-found: ignore |
| 110 | + |
| 111 | + |
| 112 | + - name: Record demo |
| 113 | + shell: bash |
| 114 | + if: success() |
| 115 | + run: | |
| 116 | + source venv/bin/activate |
| 117 | + cd CONFIG_DIR |
| 118 | + ansible-playbook -i inventory.yml playbooks/record-demo.yaml |
| 119 | +
|
| 120 | + - name: Upload the demo recording |
| 121 | + uses: actions/upload-artifact@v4 |
| 122 | + if: success() |
| 123 | + with: |
| 124 | + name: minimal-demo |
| 125 | + path: CONFIG_DIR/results/basic-demo.webm |
| 126 | + if-no-files-found: ignore |
| 127 | + |
| 128 | + - name: Shut down the environment |
| 129 | + shell: bash |
| 130 | + if: always() |
| 131 | + run: | |
| 132 | + source venv/bin/activate |
| 133 | + cd CONFIG_DIR |
| 134 | + podman-compose down |
0 commit comments