diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index f5972a65..61b7a99b 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -75,10 +75,10 @@ jobs: run: | CONTROLLER=$(juju whoami --format yaml | yq .controller) - echo "JUJU_AGENT_VERSION=$(juju show-controller | yq .$CONTROLLER.details.agent-version |tr -d '"')" >> $GITHUB_ENV + echo "JUJU_AGENT_VERSION=$(juju show-controller | yq -r .$CONTROLLER.details.agent-version)" >> $GITHUB_ENV echo "JUJU_CONTROLLER_ADDRESSES=$(juju show-controller | yq .$CONTROLLER.details.api-endpoints | yq -r '. | join(",")')" >> $GITHUB_ENV - echo "JUJU_USERNAME=$(juju show-controller | yq .$CONTROLLER.account.user)" >> $GITHUB_ENV - echo "JUJU_PASSWORD=$(cat ~/.local/share/juju/accounts.yaml | yq .controllers.$CONTROLLER.password)" >> $GITHUB_ENV + echo "JUJU_USERNAME=$(juju show-controller | yq -r .$CONTROLLER.account.user)" >> $GITHUB_ENV + echo "JUJU_PASSWORD=$(cat ~/.local/share/juju/accounts.yaml | yq -r .controllers.$CONTROLLER.password)" >> $GITHUB_ENV echo "JUJU_CA_CERT<> $GITHUB_ENV juju show-controller | yq .$CONTROLLER.details.ca-cert >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV diff --git a/.github/workflows/test_add_machine.yml b/.github/workflows/test_add_machine.yml index b6d06295..5f174054 100644 --- a/.github/workflows/test_add_machine.yml +++ b/.github/workflows/test_add_machine.yml @@ -79,12 +79,12 @@ jobs: run: | CONTROLLER=$(juju whoami --format yaml | yq .controller) - echo "JUJU_AGENT_VERSION=$(juju show-controller | yq .$CONTROLLER.details.agent-version |tr -d '"')" >> $GITHUB_ENV + echo "JUJU_AGENT_VERSION=$(juju show-controller | yq -r .$CONTROLLER.details.agent-version)" >> $GITHUB_ENV echo "JUJU_CONTROLLER_ADDRESSES=$(juju show-controller | yq .$CONTROLLER.details.api-endpoints | yq -r '. | join(",")')" >> $GITHUB_ENV - echo "JUJU_USERNAME=$(juju show-controller | yq .$CONTROLLER.account.user)" >> $GITHUB_ENV - echo "JUJU_PASSWORD=$(cat ~/.local/share/juju/accounts.yaml | yq .controllers.$CONTROLLER.password)" >> $GITHUB_ENV + echo "JUJU_USERNAME=$(juju show-controller | yq -r .$CONTROLLER.account.user)" >> $GITHUB_ENV + echo "JUJU_PASSWORD=$(cat ~/.local/share/juju/accounts.yaml | yq -r .controllers.$CONTROLLER.password)" >> $GITHUB_ENV echo "JUJU_CA_CERT<> $GITHUB_ENV - juju show-controller | yq .$CONTROLLER.details.ca-cert >> $GITHUB_ENV + juju show-controller | yq -r .$CONTROLLER.details.ca-cert >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV - run: go mod download - name: Create a new machine on lxd diff --git a/.github/workflows/test_integration.yml b/.github/workflows/test_integration.yml index 317397b2..4a218c28 100644 --- a/.github/workflows/test_integration.yml +++ b/.github/workflows/test_integration.yml @@ -88,12 +88,12 @@ jobs: run: | CONTROLLER=$(juju whoami --format yaml | yq .controller) - echo "JUJU_AGENT_VERSION=$(juju show-controller | yq .$CONTROLLER.details.agent-version |tr -d '"')" >> $GITHUB_ENV + echo "JUJU_AGENT_VERSION=$(juju show-controller | yq -r .$CONTROLLER.details.agent-version)" >> $GITHUB_ENV echo "JUJU_CONTROLLER_ADDRESSES=$(juju show-controller | yq .$CONTROLLER.details.api-endpoints | yq -r '. | join(",")')" >> $GITHUB_ENV - echo "JUJU_USERNAME=$(juju show-controller | yq .$CONTROLLER.account.user)" >> $GITHUB_ENV - echo "JUJU_PASSWORD=$(cat ~/.local/share/juju/accounts.yaml | yq .controllers.$CONTROLLER.password)" >> $GITHUB_ENV + echo "JUJU_USERNAME=$(juju show-controller | yq -r .$CONTROLLER.account.user)" >> $GITHUB_ENV + echo "JUJU_PASSWORD=$(cat ~/.local/share/juju/accounts.yaml | yq -r .controllers.$CONTROLLER.password)" >> $GITHUB_ENV echo "JUJU_CA_CERT<> $GITHUB_ENV - juju show-controller | yq .$CONTROLLER.details.ca-cert >> $GITHUB_ENV + juju show-controller | yq -r .$CONTROLLER.details.ca-cert >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV echo "TEST_MANAGEMENT_BR=10.150.40.0/24" >> $GITHUB_ENV echo "TEST_PUBLIC_BR=10.170.80.0/24" >> $GITHUB_ENV diff --git a/.github/workflows/test_integration_jaas.yaml b/.github/workflows/test_integration_jaas.yaml index 6209005c..6bf5a595 100644 --- a/.github/workflows/test_integration_jaas.yaml +++ b/.github/workflows/test_integration_jaas.yaml @@ -84,7 +84,7 @@ jobs: CONTROLLER=$(juju whoami --format yaml | yq .controller) echo "IS_JAAS=true" >> $GITHUB_ENV - echo "JUJU_AGENT_VERSION=$(juju show-controller | yq .$CONTROLLER.details.agent-version |tr -d '"')" >> $GITHUB_ENV + echo "JUJU_AGENT_VERSION=$(juju show-controller | yq -r .$CONTROLLER.details.agent-version)" >> $GITHUB_ENV echo "JUJU_CONTROLLER_ADDRESSES=$(juju show-controller | yq .$CONTROLLER.details.api-endpoints | yq -r '. | join(",")')" >> $GITHUB_ENV echo "JUJU_CLIENT_ID=${{ steps.jaas.outputs.client-id }}" >> $GITHUB_ENV echo "JUJU_CLIENT_SECRET=${{ steps.jaas.outputs.client-secret }}" >> $GITHUB_ENV diff --git a/docs/index.md b/docs/index.md index 7ec2656e..e9dcf2fd 100644 --- a/docs/index.md +++ b/docs/index.md @@ -74,11 +74,11 @@ provider "juju" { Define the Juju controller credentials in the provider definition via environment variables. These can be set up as follows: ```shell -export CONTROLLER=$(juju whoami | yq .Controller) -export JUJU_CONTROLLER_ADDRESSES="$(juju show-controller | yq '.[$CONTROLLER]'.details.\"api-endpoints\" | tr -d "[]' "|tr -d '"'|tr -d '\n')" -export JUJU_USERNAME="$(cat ~/.local/share/juju/accounts.yaml | yq .controllers.$CONTROLLER.user|tr -d '"')" -export JUJU_PASSWORD="$(cat ~/.local/share/juju/accounts.yaml | yq .controllers.$CONTROLLER.password|tr -d '"')" -export JUJU_CA_CERT="$(juju show-controller $(echo $CONTROLLER|tr -d '"') | yq '.[$CONTROLLER]'.details.\"ca-cert\"|tr -d '"'|sed 's/\\n/\n/g')" +export CONTROLLER=$(juju whoami --format yaml | yq .controller) +export JUJU_CONTROLLER_ADDRESSES=$(juju show-controller | yq .$CONTROLLER.details.\"api-endpoints\" | yq -r '. | join(",")') +export JUJU_USERNAME=$(juju show-controller | yq -r .$CONTROLLER.account.user) +export JUJU_PASSWORD=$(cat ~/.local/share/juju/accounts.yaml | yq -r .controllers.$CONTROLLER.password) +export JUJU_CA_CERT=$(juju show-controller | yq -r .$CONTROLLER.details.\"ca-cert\") ``` ### Populated by the provider via the juju CLI client. diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl index a98b9a50..89e9ccb8 100644 --- a/templates/index.md.tmpl +++ b/templates/index.md.tmpl @@ -74,11 +74,11 @@ provider "juju" { Define the Juju controller credentials in the provider definition via environment variables. These can be set up as follows: ```shell -export CONTROLLER=$(juju whoami | yq .Controller) -export JUJU_CONTROLLER_ADDRESSES="$(juju show-controller | yq '.[$CONTROLLER]'.details.\"api-endpoints\" | tr -d "[]' "|tr -d '"'|tr -d '\n')" -export JUJU_USERNAME="$(cat ~/.local/share/juju/accounts.yaml | yq .controllers.$CONTROLLER.user|tr -d '"')" -export JUJU_PASSWORD="$(cat ~/.local/share/juju/accounts.yaml | yq .controllers.$CONTROLLER.password|tr -d '"')" -export JUJU_CA_CERT="$(juju show-controller $(echo $CONTROLLER|tr -d '"') | yq '.[$CONTROLLER]'.details.\"ca-cert\"|tr -d '"'|sed 's/\\n/\n/g')" +export CONTROLLER=$(juju whoami --format yaml | yq .controller) +export JUJU_CONTROLLER_ADDRESSES=$(juju show-controller | yq .$CONTROLLER.details.\"api-endpoints\" | yq -r '. | join(",")') +export JUJU_USERNAME=$(juju show-controller | yq -r .$CONTROLLER.account.user) +export JUJU_PASSWORD=$(cat ~/.local/share/juju/accounts.yaml | yq -r .controllers.$CONTROLLER.password) +export JUJU_CA_CERT=$(juju show-controller | yq -r .$CONTROLLER.details.\"ca-cert\") ``` ### Populated by the provider via the juju CLI client.