From 6ec94eb254ceb9650dbbb64153cc383024102a98 Mon Sep 17 00:00:00 2001 From: James Nesbitt Date: Mon, 11 Dec 2023 19:46:26 +0200 Subject: [PATCH 1/2] fix for build bypass Signed-off-by: James Nesbitt --- internal/provider/k0s_config_resource.go | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/internal/provider/k0s_config_resource.go b/internal/provider/k0s_config_resource.go index 8f2e0bc..ba576c2 100644 --- a/internal/provider/k0s_config_resource.go +++ b/internal/provider/k0s_config_resource.go @@ -99,22 +99,19 @@ func (r *K0sctlConfigResource) Create(ctx context.Context, req resource.CreateRe RestoreFrom: kcsm.RestoreFrom.ValueString(), } + kcsm.KubeYaml = types.StringNull() + kcsm.KubeHost = types.StringNull() + kcsm.CaCert = types.StringNull() + kcsm.PrivateKey = types.StringNull() + kcsm.ClientCert = types.StringNull() + kcsm.Id = kcsm.Metadata.Name + if kcsm.SkipCreate.ValueBool() { resp.Diagnostics.AddWarning("skipping create", "Skipping the k0sctl create because of configuration flag.") + resp.Diagnostics.Append(resp.State.Set(ctx, kcsm)...) } else if r.testingMode { resp.Diagnostics.AddWarning("testing mode warning", "k0sctl config resource handler is in testing mode, no installation will be run.") - - kcsm.KubeYaml = types.StringNull() - kcsm.KubeHost = types.StringNull() - kcsm.CaCert = types.StringNull() - kcsm.PrivateKey = types.StringNull() - kcsm.ClientCert = types.StringNull() - - kcsm.Id = kcsm.Metadata.Name - - if diags := resp.State.Set(ctx, kcsm); diags != nil { - resp.Diagnostics.Append(diags...) - } + resp.Diagnostics.Append(resp.State.Set(ctx, kcsm)...) } else if err := aa.Run(); err != nil { resp.Diagnostics.Append(diag.NewErrorDiagnostic("error running k0sctl apply", err.Error())) } else { From 1a245f09e7c0f3dcce73708981921cfae8d1fa0b Mon Sep 17 00:00:00 2001 From: James Nesbitt Date: Wed, 13 Dec 2023 16:23:21 +0200 Subject: [PATCH 2/2] gh actions fix Signed-off-by: James Nesbitt --- .github/workflows/go.yml | 6 ++---- .github/workflows/label.yml | 2 +- .github/workflows/release.yml | 22 +++++++--------------- .github/workflows/test.yml | 26 ++++++++++++-------------- .github/workflows/tfsec.yaml | 4 ++-- .github/workflows/validate.yml | 6 ++---- 6 files changed, 26 insertions(+), 40 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d96b078..eedc0cb 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -17,11 +17,9 @@ jobs: - uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5 with: - go-version: '1.20' - - name: Setup MCC gitub repo private access - run: git config --global url."https://${{ secrets.GH_MCC_USERNAME }}:${{ secrets.GH_MCC_ACCESS_TOKEN }}@github.com/".insteadOf "https://github.com/" + go-version: '>=1.21' - name: Build run: go build -v ./... diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 7f1e2bc..aca184b 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -17,6 +17,6 @@ jobs: pull-requests: write steps: - - uses: actions/labeler@v4 + - uses: actions/labeler@v5 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 839e6c9..2c0375e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,29 +20,21 @@ jobs: goreleaser: runs-on: ubuntu-latest steps: - - name: Setup MCC gitub repo private access - run: git config --global url."https://${{ secrets.GH_MCC_USERNAME }}:${{ secrets.GH_MCC_ACCESS_TOKEN }}@github.com/".insteadOf "https://github.com/" - - - name: Checkout + - name: Checkout uses: actions/checkout@v4 - - - name: Unshallow + - name: Unshallow run: git fetch --prune --unshallow - - - name: Set up Go - uses: actions/setup-go@v3 + - name: Set up Go + uses: actions/setup-go@v5 with: - go-version-file: 'go.mod' - cache: true - - - name: Import GPG key + go-version: '1.21' + - name: Import GPG key uses: crazy-max/ghaction-import-gpg@v6 id: import_gpg with: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} passphrase: ${{ secrets.GPG_PASSPHRASE }} - - - name: Run GoReleaser + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5.0.0 with: version: latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0e172ea..6c02537 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,10 +28,10 @@ jobs: run: git config --global url."https://${{ secrets.GH_MCC_USERNAME }}:${{ secrets.GH_MCC_ACCESS_TOKEN }}@github.com/".insteadOf "https://github.com/" - uses: actions/checkout@v4 - - uses: actions/setup-go@v4.0.1 + - name: Set up Go + uses: actions/setup-go@v5 with: - go-version-file: 'go.mod' - cache: true + go-version: '1.21' - run: go mod download - run: go build -v . - name: Run linters @@ -48,10 +48,10 @@ jobs: run: git config --global url."https://${{ secrets.GH_MCC_USERNAME }}:${{ secrets.GH_MCC_ACCESS_TOKEN }}@github.com/".insteadOf "https://github.com/" - uses: actions/checkout@v4 - - uses: actions/setup-go@v4.0.1 + - name: Set up Go + uses: actions/setup-go@v5 with: - go-version-file: 'go.mod' - cache: true + go-version: '1.21' - run: go generate ./... - name: git diff run: | @@ -71,17 +71,15 @@ jobs: matrix: # list whatever Terraform versions here you would like to support terraform: - - '1.4.*' + - '1.6.*' + - '1.5.*' steps: - - name: Setup MCC gitub repo private access - run: git config --global url."https://${{ secrets.GH_MCC_USERNAME }}:${{ secrets.GH_MCC_ACCESS_TOKEN }}@github.com/".insteadOf "https://github.com/" - - uses: actions/checkout@v4 - - uses: actions/setup-go@v4.0.1 + - name: Set up Go + uses: actions/setup-go@v5 with: - go-version-file: 'go.mod' - cache: true - - uses: hashicorp/setup-terraform@v2.0.3 + go-version: '1.21' + - uses: hashicorp/setup-terraform@v3 with: terraform_version: ${{ matrix.terraform }} terraform_wrapper: false diff --git a/.github/workflows/tfsec.yaml b/.github/workflows/tfsec.yaml index 3f76e35..9ef6279 100644 --- a/.github/workflows/tfsec.yaml +++ b/.github/workflows/tfsec.yaml @@ -14,6 +14,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: tfsec - uses: aquasecurity/tfsec-pr-commenter-action@v1.2.0 + uses: aquasecurity/tfsec-pr-commenter-action@v1.3.1 with: - github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 72bd97b..dc730ff 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -8,12 +8,10 @@ jobs: - name: 'Checkout' uses: actions/checkout@v4 - name: 'Setup Terraform' - uses: hashicorp/setup-terraform@v2.0.0 - with: - terraform_version: 1.0.3 + uses: hashicorp/setup-terraform@v3 - name: Terraform Init id: init run: terraform init - name: Terraform Validate id: validate - run: terraform validate -no-color \ No newline at end of file + run: terraform validate -no-color