From e7fccd2a581f439f96627604d6ea6f7497a339a0 Mon Sep 17 00:00:00 2001 From: Keith Suderman Date: Mon, 24 Feb 2025 15:19:04 -0500 Subject: [PATCH 1/4] Add workflow to test pull requests --- .github/workflows/pr.yml | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..912c15e --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,44 @@ +name: Test pull requests +description: "Test the playbook using the galaxy-k8s action" + +on: + workflow_dispatch: {} + pull_request: + types: [opened, synchronize, reopened] + +jobs: + run: + name: Install Kubernetes and Galaxy + runs-on: ubuntu-latest + steps: + - name: Install Kubernetes and Galaxy + uses: ksuderman/galaxy-k8s-action@master + with: + api-key: secret + + - name: Check the nodes + run: | + sudo kubectl get nodes + sudo kubectl describe nodes + sudo kubectl get pods -A + + - name: Get the Galaxy version + run: curl -s http://localhost/api/version | jq + + - name: Create a Galaxy user + run: | + cat > /tmp/user.json << EOF + { + "email": "admin@example.com", + "password": "galaxypassword", + "username": "admin" + } + EOF + response=$(curl -s -H "x-api-key: secret" -H "Content-Type: application/json" -d @/tmp/user.json http://localhost/api/users) + echo $response | jq + error=$(echo $response | jq -r .err_msg) + if [[ $error != null ]]; then + echo "Error creating user: $error" + exit 1 + fi + From e4a341e99de223b51685bfdb55f33a9e1f8955dd Mon Sep 17 00:00:00 2001 From: Keith Suderman Date: Tue, 25 Feb 2025 15:53:14 -0500 Subject: [PATCH 2/4] Update .github/workflows/pr.yml Remove redundant node and Galaxy version checks. Co-authored-by: Nuwan Goonasekera <2070605+nuwang@users.noreply.github.com> --- .github/workflows/pr.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 912c15e..ddd73d3 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -16,14 +16,6 @@ jobs: with: api-key: secret - - name: Check the nodes - run: | - sudo kubectl get nodes - sudo kubectl describe nodes - sudo kubectl get pods -A - - - name: Get the Galaxy version - run: curl -s http://localhost/api/version | jq - name: Create a Galaxy user run: | From e2920976ba6abd7255778857b3e3fc4312f8fae2 Mon Sep 17 00:00:00 2001 From: Keith Suderman Date: Tue, 25 Feb 2025 16:08:28 -0500 Subject: [PATCH 3/4] Use repo location a ref name from the pull request event --- .github/workflows/pr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ddd73d3..37e9e09 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -15,7 +15,8 @@ jobs: uses: ksuderman/galaxy-k8s-action@master with: api-key: secret - + playbook-repo: ${{ github.event.pull_request.head.repo.full_name }} + playbook-ref: ${{ github.event.pull_request.head.ref }} - name: Create a Galaxy user run: | From 60d4ab7fd8df3ebe6d2a31ef3aabe492e7953077 Mon Sep 17 00:00:00 2001 From: Keith Suderman Date: Tue, 25 Feb 2025 16:22:11 -0500 Subject: [PATCH 4/4] Use v1 tag rather than master branch --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 37e9e09..9ab67f3 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Install Kubernetes and Galaxy - uses: ksuderman/galaxy-k8s-action@master + uses: ksuderman/galaxy-k8s-action@v1 with: api-key: secret playbook-repo: ${{ github.event.pull_request.head.repo.full_name }}