From 96618105fab679e61311519b2432287e7c4ac218 Mon Sep 17 00:00:00 2001 From: Kian Parvin Date: Mon, 2 Sep 2024 21:00:44 +0200 Subject: [PATCH] fixes for composite action --- .github/actions/test-server/action.yaml | 7 +++++++ local/jimm/setup-service-account.sh | 2 ++ 2 files changed, 9 insertions(+) diff --git a/.github/actions/test-server/action.yaml b/.github/actions/test-server/action.yaml index 2d2933b36..7d16cf15e 100644 --- a/.github/actions/test-server/action.yaml +++ b/.github/actions/test-server/action.yaml @@ -45,11 +45,13 @@ runs: if: ${{ inputs.jimm-version != 'dev' }} run: make integration-test-env shell: bash + working-directory: ${{ github.action_path }} env: JIMM_VERSION: ${{ inputs.jimm-version }} - name: Start server based on development version if: ${{ inputs.jimm-version == 'dev' }} + working-directory: ${{ github.action_path }} run: make dev-env shell: bash @@ -59,6 +61,7 @@ runs: echo 'jimm-ca<> $GITHUB_OUTPUT cat ./local/traefik/certs/ca.crt >> $GITHUB_OUTPUT echo 'EOF' >> $GITHUB_OUTPUT + working-directory: ${{ github.action_path }} shell: bash - name: Initialise LXD @@ -73,6 +76,7 @@ runs: - name: Setup cloud-init script for bootstraping Juju controllers run: ./local/jimm/setup-controller.sh shell: bash + working-directory: ${{ github.action_path }} env: SKIP_BOOTSTRAP: true CLOUDINIT_FILE: "cloudinit.temp.yaml" @@ -100,6 +104,7 @@ runs: - name: Authenticate Juju CLI run: chmod -R 666 ~/.local/share/juju/*.yaml && ./local/jimm/setup-cli-auth.sh + working-directory: ${{ github.action_path }} shell: bash # Below is a hardcoded JWT using the same test-secret used in JIMM's docker compose and allows the CLI to authenticate as the jimm-test@canonical.com user. env: @@ -107,6 +112,7 @@ runs: - name: Add LXD Juju controller to JIMM run: ./local/jimm/add-controller.sh + working-directory: ${{ github.action_path }} shell: bash env: JIMM_CONTROLLER_NAME: "jimm" @@ -114,4 +120,5 @@ runs: - name: Provide service account with cloud-credentials run: ./local/jimm/setup-service-account.sh + working-directory: ${{ github.action_path }} shell: bash diff --git a/local/jimm/setup-service-account.sh b/local/jimm/setup-service-account.sh index b18229a0c..254b379dd 100755 --- a/local/jimm/setup-service-account.sh +++ b/local/jimm/setup-service-account.sh @@ -1,6 +1,7 @@ #!/bin/bash # This script is used to setup a service account by adding a set of cloud-credentials. +# The service account is also made an admin of JIMM. # Default values below assume a lxd controller is added to JIMM. set -eux @@ -11,3 +12,4 @@ CREDENTIAL_NAME="${CREDENTIAL_NAME:-localhost}" juju add-service-account "$SERVICE_ACCOUNT_ID" juju update-service-account-credential "$SERVICE_ACCOUNT_ID" "$CLOUD" "$CREDENTIAL_NAME" +jimmctl auth relation add user-"$SERVICE_ACCOUNT_ID"@serviceaccount administrator controller-jimm