🧪 Test UBI8 runner #51
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: 🧪 Test UBI8 runner | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "images/ubi8.Dockerfile" | |
- "images/**.sh" | |
- "images/software/*" | |
- ".github/workflows/test-ubi8.yml" | |
jobs: | |
build: | |
name: Build test image | |
runs-on: ubuntu-latest # use the GitHub-hosted runner to build the image | |
steps: | |
- name: Set release id | |
run: echo "SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV | |
- name: Set up build summary | |
run: | | |
echo '### Build summary 🚀' >> $GITHUB_STEP_SUMMARY | |
echo ' ' >> $GITHUB_STEP_SUMMARY | |
echo '- Changes that produced this build [here](${{ github.server_url }}/${{ github.repository }}/commit/${{ env.SHA_SHORT }}) ' >> $GITHUB_STEP_SUMMARY | |
echo '- Full code at this point in time [here](${{ github.server_url }}/${{ github.repository }}/tree/${{ env.SHA_SHORT }})' >> $GITHUB_STEP_SUMMARY | |
echo ' ' >> $GITHUB_STEP_SUMMARY | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build the image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: some-natalie/kubernoodles/ubi8 | |
tags: test | |
containerfiles: images/ubi8.Dockerfile | |
- name: Push image | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-image.outputs.image }} | |
tags: ${{ steps.build-image.outputs.tags }} | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
deploy: | |
name: Deploy test image to `test-runners` namespace | |
runs-on: ubuntu-latest # use the GitHub-hosted runner to deploy the image | |
needs: [build] | |
environment: test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Write out the kubeconfig info | |
run: | | |
echo ${{ secrets.DEPLOY_ACCOUNT }} | base64 -d > /tmp/config | |
- name: Update deployment (using latest chart of actions-runner-controller-charts/auto-scaling-runner-set) | |
run: | | |
helm install test-ubi8 \ | |
--namespace "test-runners" \ | |
--set githubConfigSecret.github_app_id="${{ vars.ARC_APP_ID }}" \ | |
--set githubConfigSecret.github_app_installation_id="${{ vars.ARC_INSTALL_ID }}" \ | |
--set githubConfigSecret.github_app_private_key="${{ secrets.ARC_APP_PRIVATE_KEY }}" \ | |
-f deployments/helm-ubi8-test.yml \ | |
oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set \ | |
--version 0.9.1 | |
env: | |
KUBECONFIG: /tmp/config | |
- name: Remove kubeconfig info | |
run: rm -f /tmp/config | |
- name: Wait 5 minutes to let the new pod come up | |
run: sleep 300 | |
test: | |
name: Run tests! | |
runs-on: [test-ubi8] | |
needs: [deploy] | |
timeout-minutes: 15 | |
steps: | |
- name: Setup test summary | |
run: | | |
echo '### Test summary 🧪' >> $GITHUB_STEP_SUMMARY | |
echo ' ' >> $GITHUB_STEP_SUMMARY | |
echo '- ✅ runner builds and deploys' >> $GITHUB_STEP_SUMMARY | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Print debug info | |
uses: ./tests/debug | |
- name: Sudo fails | |
uses: ./tests/sudo-fails | |
remove-deploy: | |
name: Delete test image deployment | |
runs-on: ubuntu-latest # use the GitHub-hosted runner to remove the image | |
needs: [test] | |
environment: test | |
if: always() | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Write out the kubeconfig info | |
run: | | |
echo ${{ secrets.DEPLOY_ACCOUNT }} | base64 -d > /tmp/config | |
- name: Deploy | |
run: | | |
helm uninstall test-ubi8 --namespace "test-runners" | |
env: | |
KUBECONFIG: /tmp/config | |
- name: Remove kubeconfig info | |
run: rm -f /tmp/config | |
- name: Output removal | |
run: | | |
echo ' ' >> $GITHUB_STEP_SUMMARY | |
echo '🧹 Test deployment removed' >> $GITHUB_STEP_SUMMARY |