fix: update pipelines
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Failing after 1m43s
Publish / Check GoReleaser config (push) Failing after 1m19s
Publish / Publish provider (push) Has been skipped
CI Workflow / Prepare GO cache (pull_request) Successful in 6m55s
CI Workflow / Test readiness for publishing provider (pull_request) Has been skipped
CI Workflow / CI run tests (pull_request) Has been skipped
CI Workflow / CI run build and linting (pull_request) Has been skipped
CI Workflow / Code coverage report (pull_request) Has been skipped
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Failing after 28m45s
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Failing after 1m43s
Publish / Check GoReleaser config (push) Failing after 1m19s
Publish / Publish provider (push) Has been skipped
CI Workflow / Prepare GO cache (pull_request) Successful in 6m55s
CI Workflow / Test readiness for publishing provider (pull_request) Has been skipped
CI Workflow / CI run tests (pull_request) Has been skipped
CI Workflow / CI run build and linting (pull_request) Has been skipped
CI Workflow / Code coverage report (pull_request) Has been skipped
TF Acceptance Tests Workflow / Acceptance Tests (pull_request) Failing after 28m45s
fix: implement sql server 200 error
This commit is contained in:
parent
aaabadde1a
commit
1fd2df5c76
11 changed files with 196 additions and 15 deletions
1
.github/actions/clean_up/README.md
vendored
Normal file
1
.github/actions/clean_up/README.md
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
# acceptance test action
|
||||
148
.github/actions/clean_up/action.yaml
vendored
Normal file
148
.github/actions/clean_up/action.yaml
vendored
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
name: CleanUp Project Resources
|
||||
description: "Acceptance Testing CleanUp"
|
||||
|
||||
inputs:
|
||||
project_id:
|
||||
description: "STACKIT project ID for tests"
|
||||
required: true
|
||||
|
||||
region:
|
||||
description: "STACKIT region for tests"
|
||||
default: 'eu01'
|
||||
required: true
|
||||
|
||||
tf_resource_prefix:
|
||||
description: "prefix in resource names"
|
||||
default: 'tf-acc-'
|
||||
required: true
|
||||
|
||||
service_account_json_content:
|
||||
description: "STACKIT service account JSON file contents"
|
||||
required: true
|
||||
default: ""
|
||||
|
||||
service_account_json_content_b64:
|
||||
description: "STACKIT service account JSON file contents"
|
||||
required: true
|
||||
default: ""
|
||||
|
||||
list_only:
|
||||
description: "only list resources, DO NOT delete"
|
||||
required: true
|
||||
default: 'true'
|
||||
|
||||
outputs:
|
||||
resources:
|
||||
description: "resource list"
|
||||
value: ${{ steps.resource_lister.outputs.resources }}
|
||||
|
||||
cli-version:
|
||||
description: "stackit cli version"
|
||||
value: ${{ steps.stackit_version.outputs.version }}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Install needed tools
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::apt install"
|
||||
set -e
|
||||
apt-get -y -qq update >apt_update.log 2>apt_update_err.log
|
||||
if [ $? -ne 0 ]; then
|
||||
cat apt_update.log apt_update_err.log
|
||||
fi
|
||||
apt-get -y -qq install curl gnupg jq >apt_get.log 2>apt_get_err.log
|
||||
if [ $? -ne 0 ]; then
|
||||
cat apt_get.log apt_get_err.log
|
||||
fi
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::apt add source"
|
||||
curl https://packages.stackit.cloud/keys/key.gpg | gpg --dearmor -o /usr/share/keyrings/stackit.gpg
|
||||
echo "deb [signed-by=/usr/share/keyrings/stackit.gpg] https://packages.stackit.cloud/apt/cli stackit main" | tee -a /etc/apt/sources.list.d/stackit.list
|
||||
echo "::endgroup::"
|
||||
|
||||
echo "::group::apt install stackit cli"
|
||||
apt-get -y -qq update >apt_update.log 2>apt_update_err.log
|
||||
if [ $? -ne 0 ]; then
|
||||
cat apt_update.log apt_update_err.log
|
||||
fi
|
||||
apt-get -y -qq install stackit >apt_get.log 2>apt_get_err.log
|
||||
if [ $? -ne 0 ]; then
|
||||
cat apt_get.log apt_get_err.log
|
||||
fi
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Check stackit cli version
|
||||
id: stackit_version
|
||||
run: |
|
||||
set -e
|
||||
VERSION=$(stackit --version | grep "Version:" | cut -d " " -f 2)
|
||||
echo "stackit cli version: ${VERSION}"
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
||||
- name: Creating service_account file from json input
|
||||
if: inputs.service_account_json_content != ''
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::create service account file"
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
echo "${{ inputs.service_account_json_content }}" > .svc_acc.json
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Creating service_account file from base64 json input
|
||||
if: inputs.service_account_json_content_b64 != ''
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::group::create service account file"
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
echo "${{ inputs.service_account_json_content_b64 }}" | base64 -d > .svc_acc.json
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Check service account file exists
|
||||
shell: bash
|
||||
run: |
|
||||
set -e
|
||||
if [[ ! -s .svc_acc.json ]]; then
|
||||
echo "ERROR: service account file missing or empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Retrieve resources
|
||||
id: resource_lister
|
||||
run: |
|
||||
set -e
|
||||
STACKIT_SERVICE_ACCOUNT_KEY_PATH="${PWD}/.svc_acc.json"
|
||||
export STACKIT_SERVICE_ACCOUNT_KEY_PATH
|
||||
stackit auth activate-service-account --service-account-key-path .svc_acc.json
|
||||
RES_JSON=$(stackit --project-id "${{ inputs.project_id }}" beta sqlserverflex instance list --output-format json | jq -r '.[] | select(.name | startswith("${{ inputs.tf_resource_prefix }}"))')
|
||||
echo "resources=$(echo $RES_JSON)" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
||||
- name: List resources
|
||||
run: |
|
||||
set -e
|
||||
echo "${{ steps.resource_lister.outputs.resources }} | jq -r "
|
||||
shell: bash
|
||||
|
||||
- name: Delete SQL Server Flex resources
|
||||
if: ${{ inputs.list_only != 'true' }}
|
||||
run: |
|
||||
set -e
|
||||
stackit auth activate-service-account --service-account-key-path .svc_acc.json
|
||||
for s in $(stackit --project-id ${{ inputs.project_id }} beta sqlserverflex instance list --output-format json | jq -r '.[] | select(.name | startswith("tf-acc-")) | .id'); do stackit -y --project-id ${{ inputs.project_id }} beta sqlserverflex instance delete $s; done
|
||||
shell: bash
|
||||
|
||||
- name: Delete PostgreSQL Flex resources
|
||||
if: ${{ inputs.list_only != 'true' }}
|
||||
run: |
|
||||
set -e
|
||||
stackit auth activate-service-account --service-account-key-path .svc_acc.json
|
||||
for s in $(stackit --project-id ${{ inputs.project_id }} postgresflex instance list --output-format json | jq -r '.[] | select(.name | startswith("tf-acc-")) | .id'); do stackit -y --project-id ${{ inputs.project_id }} postgresflex instance delete $s; done
|
||||
shell: bash
|
||||
12
.github/workflows/ci_new.yaml
vendored
12
.github/workflows/ci_new.yaml
vendored
|
|
@ -28,7 +28,7 @@ jobs:
|
|||
config:
|
||||
if: ${{ github.event_name != 'schedule' }}
|
||||
name: Check GoReleaser config
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: stackit-docker
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
|
@ -40,7 +40,7 @@ jobs:
|
|||
|
||||
prepare:
|
||||
name: Prepare GO cache
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: stackit-docker
|
||||
permissions:
|
||||
actions: read # Required to identify workflow run.
|
||||
checks: write # Required to add status summary.
|
||||
|
|
@ -102,7 +102,7 @@ jobs:
|
|||
needs:
|
||||
- config
|
||||
- prepare
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: stackit-docker
|
||||
permissions:
|
||||
actions: read # Required to identify workflow run.
|
||||
checks: write # Required to add status summary.
|
||||
|
|
@ -185,7 +185,7 @@ jobs:
|
|||
|
||||
testing:
|
||||
name: CI run tests
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: stackit-docker
|
||||
needs:
|
||||
- config
|
||||
- prepare
|
||||
|
|
@ -278,7 +278,7 @@ jobs:
|
|||
main:
|
||||
if: ${{ github.event_name != 'schedule' }}
|
||||
name: CI run build and linting
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: stackit-docker
|
||||
needs:
|
||||
- config
|
||||
- prepare
|
||||
|
|
@ -329,7 +329,7 @@ jobs:
|
|||
code_coverage:
|
||||
name: "Code coverage report"
|
||||
if: github.event_name == 'pull_request' # Do not run when workflow is triggered by push to main branch
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: stackit-docker
|
||||
needs:
|
||||
- main
|
||||
- prepare
|
||||
|
|
|
|||
25
.github/workflows/clean_up.yaml
vendored
Normal file
25
.github/workflows/clean_up.yaml
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
name: TF Acceptance Test CleanUp
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
list_only:
|
||||
description: "only list resources"
|
||||
default: 'true'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
clean:
|
||||
name: Clean up
|
||||
runs-on: stackit-docker
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Clean
|
||||
uses: ./.github/actions/clean_up
|
||||
with:
|
||||
project_id: ${{ vars.TF_ACC_PROJECT_ID }}
|
||||
region: 'eu01'
|
||||
tf_resource_prefix: 'tf-acc-'
|
||||
service_account_json_content_b64: "${{ secrets.TF_ACC_SERVICE_ACCOUNT_JSON_B64 }}"
|
||||
4
.github/workflows/publish.yaml
vendored
4
.github/workflows/publish.yaml
vendored
|
|
@ -17,7 +17,7 @@ env:
|
|||
jobs:
|
||||
config:
|
||||
name: Check GoReleaser config
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: stackit-docker
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
|
@ -30,7 +30,7 @@ jobs:
|
|||
publish:
|
||||
name: "Publish provider"
|
||||
needs: config
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: stackit-docker
|
||||
permissions:
|
||||
actions: read # Required to identify workflow run.
|
||||
checks: write # Required to add status summary.
|
||||
|
|
|
|||
4
.github/workflows/release.yaml
vendored
4
.github/workflows/release.yaml
vendored
|
|
@ -16,14 +16,14 @@ permissions:
|
|||
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: stackit-docker
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
# Allow goreleaser to access older tag information.
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: https://code.forgejo.org/actions/setup-go@v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version-file: "go.mod"
|
||||
cache: true
|
||||
|
|
|
|||
4
.github/workflows/renovate.yaml
vendored
4
.github/workflows/renovate.yaml
vendored
|
|
@ -8,13 +8,13 @@ on:
|
|||
jobs:
|
||||
renovate:
|
||||
name: Renovate
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: stackit-docker
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Self-hosted Renovate
|
||||
uses: renovatebot/github-action@v46.1.4
|
||||
uses: renovatebot/github-action@v46.1.5
|
||||
with:
|
||||
configurationFile: .github/renovate.json
|
||||
# token: ${{ secrets.RENOVATE_TOKEN }}
|
||||
|
|
|
|||
2
.github/workflows/stale.yaml
vendored
2
.github/workflows/stale.yaml
vendored
|
|
@ -20,7 +20,7 @@ permissions:
|
|||
jobs:
|
||||
stale:
|
||||
name: "Stale"
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: stackit-docker
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: "Mark old PRs as stale"
|
||||
|
|
|
|||
2
.github/workflows/tf-acc-test.yaml
vendored
2
.github/workflows/tf-acc-test.yaml
vendored
|
|
@ -23,7 +23,7 @@ on:
|
|||
jobs:
|
||||
acc_test:
|
||||
name: Acceptance Tests
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: stackit-docker
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
|
|
|||
|
|
@ -158,7 +158,8 @@ func TestAccInstance(t *testing.T) {
|
|||
PreConfig: func() {
|
||||
t.Logf("testing: %s - %s", t.Name(), "create and verify")
|
||||
},
|
||||
ExpectNonEmptyPlan: true,
|
||||
// empty refresh plan
|
||||
ExpectNonEmptyPlan: false,
|
||||
Config: testutils.StringFromTemplateMust(
|
||||
"testdata/instance_template.gompl",
|
||||
exData,
|
||||
|
|
|
|||
|
|
@ -89,9 +89,15 @@ func CreateInstanceWaitHandler(
|
|||
return false, nil, fmt.Errorf("could not convert error to oapierror.GenericOpenAPIError: %w", err)
|
||||
}
|
||||
switch oapiErr.StatusCode {
|
||||
case http.StatusOK:
|
||||
return false, nil, nil
|
||||
case http.StatusNotFound:
|
||||
return false, nil, nil
|
||||
default:
|
||||
if strings.Contains(err.Error(), "is not a valid InstanceEdition") {
|
||||
tflog.Info(ctx, "API WORKAROUND", map[string]interface{}{"err": err})
|
||||
return false, nil, nil
|
||||
}
|
||||
return false, nil, fmt.Errorf("api error: %w", err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue