fix: pipeline_fixes (#18)
## Description
<!-- **Please link some issue here describing what you are trying to achieve.**
In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->
relates to #1234
## Checklist
- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)
Reviewed-on: #18
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
This commit is contained in:
parent
70f7492043
commit
ee89243b3a
6 changed files with 203 additions and 52 deletions
52
.github/actions/build/action.yaml
vendored
52
.github/actions/build/action.yaml
vendored
|
|
@ -6,14 +6,24 @@ inputs:
|
|||
description: "Go version to install"
|
||||
default: '1.25'
|
||||
required: true
|
||||
golang-cilint-version:
|
||||
description: "Golangci-lint version to install"
|
||||
default: "2.7.2"
|
||||
required: true
|
||||
java-distribution:
|
||||
description: "JAVA distribution to use (default: temurin)"
|
||||
default: 'temurin'
|
||||
java-version:
|
||||
description: "JAVA version to use (default: 21)"
|
||||
default: '21'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Install needed tools
|
||||
shell: bash
|
||||
run: |
|
||||
set -e
|
||||
apt-get -y -qq update
|
||||
apt-get -y -qq install jq python3 python3-pip python-is-python3 s3cmd git make wget
|
||||
|
||||
|
||||
- name: Install Go ${{ inputs.go-version }}
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
|
|
@ -21,14 +31,34 @@ runs:
|
|||
check-latest: true
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
# - name: Run golangci-lint
|
||||
# uses: golangci/golangci-lint-action@v9
|
||||
# with:
|
||||
# version: ${{ inputs.golang-cilint-version }}
|
||||
|
||||
- name: Install needed tools
|
||||
- name: Install go tools
|
||||
shell: bash
|
||||
run: |
|
||||
set -e
|
||||
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${{ inputs.golang-cilint-version }}
|
||||
go install golang.org/x/tools/cmd/goimports@latest
|
||||
go install github.com/hashicorp/terraform-plugin-codegen-framework/cmd/tfplugingen-framework@latest
|
||||
go install github.com/hashicorp/terraform-plugin-codegen-openapi/cmd/tfplugingen-openapi@latest
|
||||
go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@v0.24.0
|
||||
|
||||
|
||||
- name: Setup JAVA ${{ inputs.java-distribution }} ${{ inputs.go-version }}
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: ${{ inputs.java-distribution }} # See 'Supported distributions' for available options
|
||||
java-version: ${{ inputs.java-version }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Run build pkg directory
|
||||
shell: bash
|
||||
run: |
|
||||
set -e
|
||||
go run cmd/main.go build
|
||||
|
||||
|
||||
- name: Run make to build app
|
||||
shell: bash
|
||||
run: |
|
||||
set -e
|
||||
make build
|
||||
|
|
|
|||
103
.github/workflows/ci.yaml
vendored
103
.github/workflows/ci.yaml
vendored
|
|
@ -2,10 +2,14 @@ name: CI Workflow
|
|||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- alpha
|
||||
- main
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- '!main'
|
||||
- '!alpha'
|
||||
|
||||
env:
|
||||
GO_VERSION: "1.25"
|
||||
|
|
@ -13,9 +17,104 @@ env:
|
|||
CODE_COVERAGE_ARTIFACT_NAME: "code-coverage"
|
||||
|
||||
jobs:
|
||||
publish_test:
|
||||
name: "Test readiness for publishing provider"
|
||||
needs: config
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read # Required to identify workflow run.
|
||||
checks: write # Required to add status summary.
|
||||
contents: read # Required to checkout repository.
|
||||
pull-requests: write # Required to add PR comment.
|
||||
steps:
|
||||
- name: Install needed tools
|
||||
run: |
|
||||
apt-get -y -qq update
|
||||
apt-get -y -qq install jq python3 python3-pip python-is-python3 s3cmd git make wget
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Install go tools
|
||||
run: |
|
||||
go install golang.org/x/tools/cmd/goimports@latest
|
||||
go install github.com/hashicorp/terraform-plugin-codegen-framework/cmd/tfplugingen-framework@latest
|
||||
go install github.com/hashicorp/terraform-plugin-codegen-openapi/cmd/tfplugingen-openapi@latest
|
||||
|
||||
- name: Setup JAVA
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||
java-version: '21'
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Run build pkg directory
|
||||
run: |
|
||||
go run cmd/main.go build
|
||||
|
||||
- name: Set up s3cfg
|
||||
run: |
|
||||
cat <<'EOF' >> ~/.s3cfg
|
||||
[default]
|
||||
host_base = https://object.storage.eu01.onstackit.cloud
|
||||
host_bucket = https://%(bucket).object.storage.eu01.onstackit.cloud
|
||||
check_ssl_certificate = False
|
||||
access_key = ${{ secrets.S3_ACCESS_KEY }}
|
||||
secret_key = ${{ secrets.S3_SECRET_KEY }}
|
||||
EOF
|
||||
|
||||
- name: Import GPG key
|
||||
run: |
|
||||
echo "${{ secrets.PRIVATE_KEY_PEM }}" > ~/private.key.pem
|
||||
gpg --import ~/private.key.pem
|
||||
rm ~/private.key.pem
|
||||
|
||||
- name: Run GoReleaser with SNAPSHOT
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
id: goreleaser
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ env.FORGEJO_TOKEN }}
|
||||
GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }}
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
args: release --skip publish --clean --snapshot
|
||||
|
||||
- name: Run GoReleaser
|
||||
if: github.event_name != 'workflow_dispatch'
|
||||
id: goreleaser
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ env.FORGEJO_TOKEN }}
|
||||
GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }}
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
args: release --skip publish --clean
|
||||
|
||||
- name: Prepare key file
|
||||
run: |
|
||||
echo "${{ secrets.PUBLIC_KEY_PEM }}" >public_key.pem
|
||||
|
||||
- name: Prepare provider directory structure
|
||||
run: |
|
||||
VERSION=$(jq -r .version < dist/metadata.json)
|
||||
go run cmd/main.go \
|
||||
publish \
|
||||
--namespace=mhenselin \
|
||||
--providerName=stackitprivatepreview \
|
||||
--repoName=terraform-provider-stackitprivatepreview \
|
||||
--domain=tfregistry.sysops.stackit.rocks \
|
||||
--gpgFingerprint=${{ secrets.GPG_FINGERPRINT }} \
|
||||
--gpgPubKeyFile=public_key.pem \
|
||||
--version=${VERSION}
|
||||
|
||||
|
||||
main:
|
||||
name: CI
|
||||
runs-on: ubuntu-latest
|
||||
needs: config
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
|
@ -57,10 +156,8 @@ jobs:
|
|||
name: ${{ env.CODE_COVERAGE_ARTIFACT_NAME }}
|
||||
path: "stackit/${{ env.CODE_COVERAGE_FILE_NAME }}"
|
||||
|
||||
|
||||
config:
|
||||
name: Check GoReleaser config
|
||||
if: github.event_name == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
|
|
|||
4
.github/workflows/publish.yaml
vendored
4
.github/workflows/publish.yaml
vendored
|
|
@ -3,10 +3,6 @@ name: Publish
|
|||
run-name: Publish by @${{ github.actor }}
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- alpha
|
||||
- main
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue