From 54188295c845acb911a720603618b86525885b3e Mon Sep 17 00:00:00 2001 From: Heather Lanigan Date: Tue, 5 Dec 2023 14:28:23 -0500 Subject: [PATCH 1/3] Ensure we have a suggested series from resolveCharm. Between juju 2.9 and 3.x, there is a move from using series to base. This provider client is using the juju 2.9.46 code base for API, but may be run against 2.9, 3.1.x, 3.3.x controller with the expection that current functionality will work. Trust the base first as 3.1 may not return a series in the charm.URL. Fall back is the series from the URL. --- internal/juju/applications.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/juju/applications.go b/internal/juju/applications.go index f02570a9..bf0be1b1 100644 --- a/internal/juju/applications.go +++ b/internal/juju/applications.go @@ -267,7 +267,14 @@ func (c applicationsClient) CreateApplication(ctx context.Context, input *Create return nil, jujuerrors.NotSupportedf("deploying bundles") } - seriesToUse, err := c.seriesToUse(modelconfigAPIClient, userSuppliedSeries, resolvedOrigin.Series, set.NewStrings(supportedSeries...)) + // Of the resolvedURL.Series, resolvedOrigin.Series and resolvedOrigin.Base, + // the latter is the only trustworthy across all juju controllers supported. + suggestedSeries, err := series.GetSeriesFromBase(resolvedOrigin.Base) + if err != nil { + return nil, err + } + + seriesToUse, err := c.seriesToUse(modelconfigAPIClient, userSuppliedSeries, suggestedSeries, set.NewStrings(supportedSeries...)) if err != nil { return nil, err } @@ -441,7 +448,7 @@ func (c applicationsClient) seriesToUse(modelconfigAPIClient *apimodelconfig.Cli // If the inputSeries is supported by the charm and is a supported // workload series, use that. if charmSeries.Contains(inputSeries) && supportedWorkloadSeries.Contains(inputSeries) { - return suggestedSeries, nil + return inputSeries, nil } else if inputSeries != "" { return "", jujuerrors.NewNotSupported(nil, fmt.Sprintf("series %q either not supported by the charm, or an unsupported juju workload series with the current version of juju.", inputSeries)) From ec9448919293ed08083e3bb8ae489b71246782e8 Mon Sep 17 00:00:00 2001 From: Heather Lanigan Date: Tue, 5 Dec 2023 14:30:55 -0500 Subject: [PATCH 2/3] Include juju 3.1/stable when running canary and integration tests. Should have caught issue #352 earlier. Increase our testing coverage to help fill the gap. Split into 2 test matrices for juju 2.9 & 3.1 Juju 3.1 requires a strictly confined version of the microk8s snap, will 2.9 uses classic. Further splitting of the tests required due to bug in charmed-kubernetes actions operator, there is not a tag specific for a microk8s channel. --- .github/workflows/canary.yml | 106 +++++++++++++++++- .github/workflows/test_add_machine.yml | 9 +- .github/workflows/test_integration.yml | 125 +++++++++++++++++++++- .github/workflows/test_new_candidates.yml | 2 +- 4 files changed, 233 insertions(+), 9 deletions(-) diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index 855e216f..75116b62 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -25,7 +25,7 @@ jobs: - run: go build -v . # Run acceptance tests in a matrix with Terraform CLI versions - test: + test29: name: Terraform Provider Acceptance Tests needs: - build @@ -38,9 +38,9 @@ jobs: - "lxd" - "microk8s" terraform: - - "1.4.*" - - "1.5.*" - "1.6.*" + juju: + - "2.9/stable" steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 @@ -55,7 +55,7 @@ jobs: uses: charmed-kubernetes/actions-operator@main with: provider: ${{ matrix.cloud }} - juju-channel: 2.9/stable + juju-channel: ${{ matrix.juju }} - name: "Set environment to configure provider" # language=bash run: | @@ -71,4 +71,100 @@ jobs: TF_ACC: "1" TEST_CLOUD: ${{ matrix.cloud }} run: go test -timeout 40m -v -cover ./internal/provider/ - + + # test-31-microk8s is different from test-31-lxd as the + # charmed-kubernetes/actions-operator does not have the ability + # to specify a microk8s specific channel. Channel is generic + # and the operator tried to use for lxd, which fails. Bug filed. + test-31-microk8s: + name: Terraform Provider Acceptance Tests + needs: + - build + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + cloud: + - "microk8s" + terraform: + - "1.6.*" + juju: + - "3.1/stable" + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v4 + with: + go-version-file: "go.mod" + cache: true + - uses: hashicorp/setup-terraform@v3 + with: + terraform_version: ${{ matrix.terraform }} + terraform_wrapper: false + - name: Setup operator environment + uses: charmed-kubernetes/actions-operator@main + with: + provider: ${{ matrix.cloud }} + juju-channel: ${{ matrix.juju }} + channel: "1.28-strict/stable" + - name: "Set environment to configure provider" + # language=bash + run: | + CONTROLLER=$(juju whoami --format yaml | yq .controller) + + 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_CA_CERT<> $GITHUB_ENV + juju show-controller | yq .$CONTROLLER.details.ca-cert >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + - env: + TF_ACC: "1" + TEST_CLOUD: ${{ matrix.cloud }} + run: go test -timeout 40m -v -cover ./internal/provider/ + + test-31-lxd: + name: Terraform Provider Acceptance Tests + needs: + - build + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + cloud: + - "lxd" + terraform: + - "1.6.*" + juju: + - "3.1/stable" + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v4 + with: + go-version-file: "go.mod" + cache: true + - uses: hashicorp/setup-terraform@v3 + with: + terraform_version: ${{ matrix.terraform }} + terraform_wrapper: false + - name: Setup operator environment + uses: charmed-kubernetes/actions-operator@main + with: + provider: ${{ matrix.cloud }} + juju-channel: ${{ matrix.juju }} + - name: "Set environment to configure provider" + # language=bash + run: | + CONTROLLER=$(juju whoami --format yaml | yq .controller) + + 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_CA_CERT<> $GITHUB_ENV + juju show-controller | yq .$CONTROLLER.details.ca-cert >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + - env: + TF_ACC: "1" + TEST_CLOUD: ${{ matrix.cloud }} + run: go test -timeout 40m -v -cover ./internal/provider/ \ No newline at end of file diff --git a/.github/workflows/test_add_machine.yml b/.github/workflows/test_add_machine.yml index 92ff655d..83aa26af 100644 --- a/.github/workflows/test_add_machine.yml +++ b/.github/workflows/test_add_machine.yml @@ -9,12 +9,16 @@ on: paths-ignore: - "README.md" - "project-docs/**" + - ".github/ISSUE_TEMPLATE/**" + - ".github/PULL_REQUEST_TEMPLATE.md" push: branches: - "main" paths-ignore: - "README.md" - "project-docs/**" + - ".github/ISSUE_TEMPLATE/**" + - ".github/PULL_REQUEST_TEMPLATE.md" # Testing only needs permissions to read the repository contents. permissions: @@ -46,6 +50,9 @@ jobs: - "lxd" terraform: - "1.6.*" + juju: + - "2.9/stable" + - "3.1/stable" timeout-minutes: 60 steps: - uses: actions/checkout@v4 @@ -63,7 +70,7 @@ jobs: uses: charmed-kubernetes/actions-operator@main with: provider: ${{ matrix.cloud }} - juju-channel: 2.9/stable + juju-channel: ${{ matrix.juju }} - name: "Set environment to configure provider" # language=bash run: | diff --git a/.github/workflows/test_integration.yml b/.github/workflows/test_integration.yml index 0bfb0253..e68bb339 100644 --- a/.github/workflows/test_integration.yml +++ b/.github/workflows/test_integration.yml @@ -8,12 +8,16 @@ on: paths-ignore: - "README.md" - "project-docs/**" + - ".github/ISSUE_TEMPLATE/**" + - ".github/PULL_REQUEST_TEMPLATE.md" push: branches: - "main" paths-ignore: - "README.md" - "project-docs/**" + - ".github/ISSUE_TEMPLATE/**" + - ".github/PULL_REQUEST_TEMPLATE.md" # Testing only needs permissions to read the repository contents. permissions: @@ -31,7 +35,10 @@ jobs: - run: go build -v . # Run acceptance tests in a matrix with Terraform CLI versions - test: + # Using juju 2.9/stable which requires a classic version + # of the microk8s snap. This happens to be the default snap + # today. + test-29: name: Integration needs: build runs-on: ubuntu-latest @@ -46,6 +53,8 @@ jobs: - "1.4.*" - "1.5.*" - "1.6.*" + juju: + - "2.9/stable" timeout-minutes: 60 steps: - uses: actions/checkout@v4 @@ -61,7 +70,119 @@ jobs: uses: charmed-kubernetes/actions-operator@main with: provider: ${{ matrix.cloud }} - juju-channel: 2.9/stable + juju-channel: ${{ matrix.juju }} + - name: "Set environment to configure provider" + # language=bash + run: | + CONTROLLER=$(juju whoami --format yaml | yq .controller) + + 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_CA_CERT<> $GITHUB_ENV + juju show-controller | yq .$CONTROLLER.details.ca-cert >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + - run: go mod download + - env: + TF_ACC: "1" + TEST_CLOUD: ${{ matrix.cloud }} + run: go test -timeout 40m -v -cover ./internal/provider/ + timeout-minutes: 40 + + # Run acceptance tests in a matrix with Terraform CLI versions + # Using juju 3.1/stable which requires a strictly confined version + # of the microk8s snap. + # + # test-31-microk8s is different from test-31-lxd as the + # charmed-kubernetes/actions-operator does not have the ability + # to specify a microk8s specific channel. Channel is generic + # and the operator tried to use for lxd, which fails. Bug filed. + test-31-microk8s: + name: Integration + needs: build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + # Different clouds + cloud: + - "microk8s" + terraform: + - "1.4.*" + - "1.5.*" + - "1.6.*" + juju: + - "3.1/stable" + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v4 + with: + go-version-file: "go.mod" + cache: true + - uses: hashicorp/setup-terraform@v3 + with: + terraform_version: ${{ matrix.terraform }} + terraform_wrapper: false + - name: Setup operator environment + uses: charmed-kubernetes/actions-operator@main + with: + provider: ${{ matrix.cloud }} + juju-channel: ${{ matrix.juju }} + channel: "1.28-strict/stable" + - name: "Set environment to configure provider" + # language=bash + run: | + CONTROLLER=$(juju whoami --format yaml | yq .controller) + + 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_CA_CERT<> $GITHUB_ENV + juju show-controller | yq .$CONTROLLER.details.ca-cert >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + - run: go mod download + - env: + TF_ACC: "1" + TEST_CLOUD: ${{ matrix.cloud }} + run: go test -timeout 40m -v -cover ./internal/provider/ + timeout-minutes: 40 + + # Run acceptance tests in a matrix with Terraform CLI versions + # Using juju 3.1/stable which requires a strictly confined version + # of the microk8s snap. + test-31-lxd: + name: Integration + needs: build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + # Different clouds + cloud: + - "lxd" + terraform: + - "1.4.*" + - "1.5.*" + - "1.6.*" + juju: + - "3.1/stable" + timeout-minutes: 60 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v4 + with: + go-version-file: "go.mod" + cache: true + - uses: hashicorp/setup-terraform@v3 + with: + terraform_version: ${{ matrix.terraform }} + terraform_wrapper: false + - name: Setup operator environment + uses: charmed-kubernetes/actions-operator@main + with: + provider: ${{ matrix.cloud }} + juju-channel: ${{ matrix.juju }} - name: "Set environment to configure provider" # language=bash run: | diff --git a/.github/workflows/test_new_candidates.yml b/.github/workflows/test_new_candidates.yml index fa55295f..c444f70f 100644 --- a/.github/workflows/test_new_candidates.yml +++ b/.github/workflows/test_new_candidates.yml @@ -20,8 +20,8 @@ jobs: matrix: juju_track: - "2.9" + - "3.1" juju_risk: - # - "candidate" - "edge" terraform: - "1.5.*" From 4fdf3e4b8177b39f10e682abcc8b7325d00a5897 Mon Sep 17 00:00:00 2001 From: Heather Lanigan Date: Wed, 6 Dec 2023 09:21:51 -0500 Subject: [PATCH 3/3] Use matrix include. This solves the problem in the matrix where the channel is only necessary for microk8s clouds and not lxd. It also allows for 1 test configuration rather than many.. --- .github/workflows/canary.yml | 120 +++---------------- .github/workflows/test_integration.yml | 136 +++------------------- .github/workflows/test_new_candidates.yml | 26 +++-- 3 files changed, 50 insertions(+), 232 deletions(-) diff --git a/.github/workflows/canary.yml b/.github/workflows/canary.yml index 75116b62..a5aac295 100644 --- a/.github/workflows/canary.yml +++ b/.github/workflows/canary.yml @@ -25,7 +25,7 @@ jobs: - run: go build -v . # Run acceptance tests in a matrix with Terraform CLI versions - test29: + test: name: Terraform Provider Acceptance Tests needs: - build @@ -34,13 +34,21 @@ jobs: strategy: fail-fast: false matrix: - cloud: - - "lxd" - - "microk8s" terraform: - "1.6.*" - juju: - - "2.9/stable" + include: + - cloud: "lxd" + cloud-channel: "5.19/stable" + juju-channel: "2.9/stable" + - cloud: "microk8s" + cloud-channel: "1.28/stable" + juju-channel: "2.9/stable" + - cloud: "lxd" + cloud-channel: "5.19/stable" + juju-channel: "3.1/stable" + - cloud: "microk8s" + cloud-channel: "1.28-strict/stable" + juju-channel: "3.1/stable" steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 @@ -55,104 +63,8 @@ jobs: uses: charmed-kubernetes/actions-operator@main with: provider: ${{ matrix.cloud }} - juju-channel: ${{ matrix.juju }} - - name: "Set environment to configure provider" - # language=bash - run: | - CONTROLLER=$(juju whoami --format yaml | yq .controller) - - 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_CA_CERT<> $GITHUB_ENV - juju show-controller | yq .$CONTROLLER.details.ca-cert >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - env: - TF_ACC: "1" - TEST_CLOUD: ${{ matrix.cloud }} - run: go test -timeout 40m -v -cover ./internal/provider/ - - # test-31-microk8s is different from test-31-lxd as the - # charmed-kubernetes/actions-operator does not have the ability - # to specify a microk8s specific channel. Channel is generic - # and the operator tried to use for lxd, which fails. Bug filed. - test-31-microk8s: - name: Terraform Provider Acceptance Tests - needs: - - build - runs-on: ubuntu-latest - timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - cloud: - - "microk8s" - terraform: - - "1.6.*" - juju: - - "3.1/stable" - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 - with: - go-version-file: "go.mod" - cache: true - - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: ${{ matrix.terraform }} - terraform_wrapper: false - - name: Setup operator environment - uses: charmed-kubernetes/actions-operator@main - with: - provider: ${{ matrix.cloud }} - juju-channel: ${{ matrix.juju }} - channel: "1.28-strict/stable" - - name: "Set environment to configure provider" - # language=bash - run: | - CONTROLLER=$(juju whoami --format yaml | yq .controller) - - 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_CA_CERT<> $GITHUB_ENV - juju show-controller | yq .$CONTROLLER.details.ca-cert >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - env: - TF_ACC: "1" - TEST_CLOUD: ${{ matrix.cloud }} - run: go test -timeout 40m -v -cover ./internal/provider/ - - test-31-lxd: - name: Terraform Provider Acceptance Tests - needs: - - build - runs-on: ubuntu-latest - timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - cloud: - - "lxd" - terraform: - - "1.6.*" - juju: - - "3.1/stable" - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 - with: - go-version-file: "go.mod" - cache: true - - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: ${{ matrix.terraform }} - terraform_wrapper: false - - name: Setup operator environment - uses: charmed-kubernetes/actions-operator@main - with: - provider: ${{ matrix.cloud }} - juju-channel: ${{ matrix.juju }} + channel: ${{ matrix.cloud-channel }} + juju-channel: ${{ matrix.juju-channel }} - name: "Set environment to configure provider" # language=bash run: | diff --git a/.github/workflows/test_integration.yml b/.github/workflows/test_integration.yml index e68bb339..4276ef23 100644 --- a/.github/workflows/test_integration.yml +++ b/.github/workflows/test_integration.yml @@ -38,23 +38,30 @@ jobs: # Using juju 2.9/stable which requires a classic version # of the microk8s snap. This happens to be the default snap # today. - test-29: + test: name: Integration needs: build runs-on: ubuntu-latest strategy: fail-fast: false matrix: - # Different clouds - cloud: - - "lxd" - - "microk8s" terraform: - "1.4.*" - "1.5.*" - "1.6.*" - juju: - - "2.9/stable" + include: + - cloud: "lxd" + cloud-channel: "5.19/stable" + juju-channel: "2.9/stable" + - cloud: "microk8s" + cloud-channel: "1.28/stable" + juju-channel: "2.9/stable" + - cloud: "lxd" + cloud-channel: "5.19/stable" + juju-channel: "3.1/stable" + - cloud: "microk8s" + cloud-channel: "1.28-strict/stable" + juju-channel: "3.1/stable" timeout-minutes: 60 steps: - uses: actions/checkout@v4 @@ -70,119 +77,8 @@ jobs: uses: charmed-kubernetes/actions-operator@main with: provider: ${{ matrix.cloud }} - juju-channel: ${{ matrix.juju }} - - name: "Set environment to configure provider" - # language=bash - run: | - CONTROLLER=$(juju whoami --format yaml | yq .controller) - - 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_CA_CERT<> $GITHUB_ENV - juju show-controller | yq .$CONTROLLER.details.ca-cert >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - run: go mod download - - env: - TF_ACC: "1" - TEST_CLOUD: ${{ matrix.cloud }} - run: go test -timeout 40m -v -cover ./internal/provider/ - timeout-minutes: 40 - - # Run acceptance tests in a matrix with Terraform CLI versions - # Using juju 3.1/stable which requires a strictly confined version - # of the microk8s snap. - # - # test-31-microk8s is different from test-31-lxd as the - # charmed-kubernetes/actions-operator does not have the ability - # to specify a microk8s specific channel. Channel is generic - # and the operator tried to use for lxd, which fails. Bug filed. - test-31-microk8s: - name: Integration - needs: build - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - # Different clouds - cloud: - - "microk8s" - terraform: - - "1.4.*" - - "1.5.*" - - "1.6.*" - juju: - - "3.1/stable" - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 - with: - go-version-file: "go.mod" - cache: true - - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: ${{ matrix.terraform }} - terraform_wrapper: false - - name: Setup operator environment - uses: charmed-kubernetes/actions-operator@main - with: - provider: ${{ matrix.cloud }} - juju-channel: ${{ matrix.juju }} - channel: "1.28-strict/stable" - - name: "Set environment to configure provider" - # language=bash - run: | - CONTROLLER=$(juju whoami --format yaml | yq .controller) - - 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_CA_CERT<> $GITHUB_ENV - juju show-controller | yq .$CONTROLLER.details.ca-cert >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - run: go mod download - - env: - TF_ACC: "1" - TEST_CLOUD: ${{ matrix.cloud }} - run: go test -timeout 40m -v -cover ./internal/provider/ - timeout-minutes: 40 - - # Run acceptance tests in a matrix with Terraform CLI versions - # Using juju 3.1/stable which requires a strictly confined version - # of the microk8s snap. - test-31-lxd: - name: Integration - needs: build - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - # Different clouds - cloud: - - "lxd" - terraform: - - "1.4.*" - - "1.5.*" - - "1.6.*" - juju: - - "3.1/stable" - timeout-minutes: 60 - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 - with: - go-version-file: "go.mod" - cache: true - - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: ${{ matrix.terraform }} - terraform_wrapper: false - - name: Setup operator environment - uses: charmed-kubernetes/actions-operator@main - with: - provider: ${{ matrix.cloud }} - juju-channel: ${{ matrix.juju }} + channel: ${{ matrix.cloud-channel }} + juju-channel: ${{ matrix.juju-channel }} - name: "Set environment to configure provider" # language=bash run: | diff --git a/.github/workflows/test_new_candidates.yml b/.github/workflows/test_new_candidates.yml index c444f70f..98cf390f 100644 --- a/.github/workflows/test_new_candidates.yml +++ b/.github/workflows/test_new_candidates.yml @@ -18,28 +18,37 @@ jobs: fail-fast: false max-parallel: 4 matrix: - juju_track: - - "2.9" - - "3.1" - juju_risk: + juju-risk: - "edge" terraform: - - "1.5.*" - "1.6.*" + include: + - cloud: "lxd" + cloud-channel: "5.19/stable" + juju-track: "2.9" + - cloud: "microk8s" + cloud-channel: "1.28/stable" + juju-track: "2.9" + - cloud: "lxd" + cloud-channel: "5.19/stable" + juju-track: "3.1" + - cloud: "microk8s" + cloud-channel: "1.28-strict/stable" + juju-track: "3.1" steps: - name: Set channel and artifact id run: | - channel=$(echo ${{ matrix.juju_track }}/${{ matrix.juju_risk }}) + channel=$(echo ${{ matrix.juju-track }}/${{ matrix.juju-risk }}) echo "Target channel is $channel" echo "channel=$channel" >> $GITHUB_ENV terraform_version=$(echo ${{ matrix.terraform }} | awk -F'\.' '{print $1$2}') - id=$(echo ${{ github.sha }}-${{ matrix.juju_track }}-${{ matrix.juju_risk }}-$terraform_version) + id=$(echo ${{ github.sha }}-${{ matrix.juju-track }}-${{ matrix.juju-risk }}-$terraform_version) echo "Target id is $id" echo "id=$id" >> $GITHUB_ENV - name: Checkout branch uses: actions/checkout@v4 with: - ref: ${{ env.juju_track }} + ref: ${{ env.juju-track }} - name: Download artifact uses: dawidd6/action-download-artifact@v2 id: download_artifact @@ -87,6 +96,7 @@ jobs: uses: charmed-kubernetes/actions-operator@main with: provider: ${{ matrix.cloud }} + channel: ${{ matrix.cloud-channel }} juju-channel: ${{ env.channel }} - name: "Set environment to configure provider" if: ${{ env.next-test != 'NA' }}