Skip to content

Commit

Permalink
fixes for composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
kian99 committed Sep 2, 2024
1 parent 11512d7 commit 9661810
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/actions/test-server/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -59,6 +61,7 @@ runs:
echo 'jimm-ca<<EOF' >> $GITHUB_OUTPUT
cat ./local/traefik/certs/ca.crt >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
working-directory: ${{ github.action_path }}
shell: bash

- name: Initialise LXD
Expand All @@ -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"
Expand Down Expand Up @@ -100,18 +104,21 @@ 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 [email protected] user.
env:
JWT: ZXlKMGVYQWlPaUpLVjFRaUxDSmhiR2NpT2lKSVV6STFOaUo5LmV5SnBjM01pT2lKUGJteHBibVVnU2xkVUlFSjFhV3hrWlhJaUxDSnBZWFFpT2pFM01qUXlNamcyTmpBc0ltVjRjQ0k2TXprMk5EYzFNelEyTUN3aVlYVmtJam9pYW1sdGJTSXNJbk4xWWlJNkltcHBiVzB0ZEdWemRFQmpZVzV2Ym1sallXd3VZMjl0SW4wLkpTWVhXcGF6T0FnX1VFZ2hkbjlOZkVQdWxhWWlJQVdaX3BuSmRDbnJvWEk=

- 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"
CONTROLLER_NAME: ${{ steps.lxd-controller.outputs.name }}

- name: Provide service account with cloud-credentials
run: ./local/jimm/setup-service-account.sh
working-directory: ${{ github.action_path }}
shell: bash
2 changes: 2 additions & 0 deletions local/jimm/setup-service-account.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

0 comments on commit 9661810

Please sign in to comment.