Skip to content

Commit

Permalink
Merge pull request #358 from hmlanigan/fix-issue-352
Browse files Browse the repository at this point in the history
Find operating system for deploy regardless of juju controller version.
  • Loading branch information
hmlanigan authored Dec 7, 2023
2 parents a669508 + 4fdf3e4 commit 2e7093f
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 24 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,21 @@ jobs:
strategy:
fail-fast: false
matrix:
cloud:
- "lxd"
- "microk8s"
terraform:
- "1.4.*"
- "1.5.*"
- "1.6.*"
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
Expand All @@ -55,7 +63,8 @@ jobs:
uses: charmed-kubernetes/actions-operator@main
with:
provider: ${{ matrix.cloud }}
juju-channel: 2.9/stable
channel: ${{ matrix.cloud-channel }}
juju-channel: ${{ matrix.juju-channel }}
- name: "Set environment to configure provider"
# language=bash
run: |
Expand All @@ -70,5 +79,4 @@ jobs:
- env:
TF_ACC: "1"
TEST_CLOUD: ${{ matrix.cloud }}
run: go test -timeout 40m -v -cover ./internal/provider/

run: go test -timeout 40m -v -cover ./internal/provider/
9 changes: 8 additions & 1 deletion .github/workflows/test_add_machine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -46,6 +50,9 @@ jobs:
- "lxd"
terraform:
- "1.6.*"
juju:
- "2.9/stable"
- "3.1/stable"
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
Expand All @@ -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: |
Expand Down
27 changes: 22 additions & 5 deletions .github/workflows/test_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -31,21 +35,33 @@ jobs:
- run: go build -v .

# Run acceptance tests in a matrix with Terraform CLI versions
# Using juju 2.9/stable which requires a classic version
# of the microk8s snap. This happens to be the default snap
# today.
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.*"
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
Expand All @@ -61,7 +77,8 @@ jobs:
uses: charmed-kubernetes/actions-operator@main
with:
provider: ${{ matrix.cloud }}
juju-channel: 2.9/stable
channel: ${{ matrix.cloud-channel }}
juju-channel: ${{ matrix.juju-channel }}
- name: "Set environment to configure provider"
# language=bash
run: |
Expand Down
26 changes: 18 additions & 8 deletions .github/workflows/test_new_candidates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,37 @@ jobs:
fail-fast: false
max-parallel: 4
matrix:
juju_track:
- "2.9"
juju_risk:
# - "candidate"
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
Expand Down Expand Up @@ -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' }}
Expand Down
11 changes: 9 additions & 2 deletions internal/juju/applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 2e7093f

Please sign in to comment.