Skip to content

feat: automate Crossplane generation process #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
3ee96b6
add update terraform provider version action
yfodil Dec 5, 2023
50f58cc
use github cli to fetch last terraform provider release
yfodil Dec 12, 2023
8a248ef
add provider metadata comparator
yfodil Dec 29, 2023
0a4af09
add resource generator
yfodil Dec 29, 2023
15f6726
update action
yfodil Dec 29, 2023
d46a4ba
go.mod
yfodil Dec 29, 2023
89b0d52
add types file
yfodil Dec 29, 2023
0802b32
refactor to reduce cyclomatic complexity
yfodil Dec 29, 2023
18bde1a
set golangci lint version to latest
yfodil Dec 29, 2023
cbe3a14
Merge branch 'main' into feat/automate_generation
yfodil Apr 26, 2024
5f8c834
Merge branch 'main' into feat/automate_generation
yfodil Jun 5, 2024
4662a7c
move templates to a separate file
yfodil Jun 6, 2024
8b4dac9
set go to 1.22
yfodil Jun 6, 2024
7c8df0b
go mod tidy
yfodil Jun 6, 2024
f743a84
lint
yfodil Jun 6, 2024
b4998a4
Merge branch 'main' into feat/automate_generation
yfodil Aug 6, 2024
c5d8a2a
fix Kind fetching
yfodil Aug 7, 2024
14f1242
gofmt the generated files
yfodil Aug 7, 2024
5008cd3
go mod tidy
yfodil Aug 7, 2024
a6631a3
fix
yfodil Aug 7, 2024
59ae88a
fix
yfodil Aug 7, 2024
4929cbd
fix
yfodil Aug 7, 2024
b0bb34f
fix
yfodil Aug 7, 2024
9c4225e
fix
yfodil Aug 7, 2024
f72314e
extract check tf version to a script
yfodil Aug 7, 2024
7b318d2
extract to a func and add tests
yfodil Aug 7, 2024
494988c
fix
yfodil Aug 7, 2024
966132e
Merge branch 'main' into feat/automate_generation
yfodil Aug 7, 2024
6dd0e0d
Bump zeebe-io/backport-action from 3.0.2 to 3.1.0 (#95)
dependabot[bot] Sep 12, 2024
7acd954
chore: bump scaleway terraform version to 2.46.0 (#101)
yfodil Oct 29, 2024
d429140
chore(deps): bump codecov/codecov-action from 4 to 5 (#106)
dependabot[bot] Dec 26, 2024
d10380f
chore: bump golang.org/x/net (#112)
remyleone Dec 31, 2024
b63c462
chore: bump scw terraform provider to 2.49.0 (#120)
remyleone Feb 6, 2025
9f6dd4a
migrate to ubuntu-24.04 (#122)
remyleone Feb 6, 2025
33d1505
chore: upgrade terraform and go version (#121)
remyleone Feb 6, 2025
36e0beb
feat: add ipam refs (#127)
yfodil Feb 18, 2025
b5aca96
chore: rename go module (#128)
yfodil Feb 20, 2025
f289c3e
chore: replace deprecated type field by TerraformName (#129)
yfodil Feb 21, 2025
497e030
chore(deps): bump zeebe-io/backport-action from 3.1.0 to 3.2.0 (#130)
dependabot[bot] Mar 3, 2025
5753fb7
chore(deps): bump golangci/golangci-lint-action from 6 to 7 (#136)
dependabot[bot] Apr 2, 2025
7ffbeef
go mod tidy
yfodil Aug 7, 2024
20f6fed
go mod tidy
yfodil Apr 25, 2025
95ef070
update go mod
yfodil Apr 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
# The main gotchas with this action are that it _only_ supports merge commits,
# and that PRs _must_ be labelled before they're merged to trigger a backport.
open-pr:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: github.event.pull_request.merged
steps:
- name: Checkout
Expand All @@ -27,7 +27,7 @@ jobs:
fetch-depth: 0

- name: Open Backport PR
uses: zeebe-io/backport-action@v3.0.2
uses: zeebe-io/backport-action@v3.2.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_workspace: ${{ github.workspace }}
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

env:
# Common versions
GO_VERSION: '1.21'
GO_VERSION: '1.23'
DOCKER_BUILDX_VERSION: 'v0.8.2'

# Common users. We can't run a step 'if secrets.XXX != ""' but we can run a
Expand All @@ -21,7 +21,7 @@ env:

jobs:
detect-noop:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
outputs:
noop: ${{ steps.noop.outputs.should_skip }}
steps:
Expand All @@ -35,7 +35,7 @@ jobs:


lint:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'

Expand Down Expand Up @@ -69,13 +69,13 @@ jobs:
# We could run 'make lint' but we prefer this action because it leaves
# 'annotations' (i.e. it comments on PRs to point out linter violations).
- name: Lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v7
with:
version: latest
args: --timeout 10m

check-diff:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'

Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
run: make check-diff

unit-tests:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'

Expand Down Expand Up @@ -144,13 +144,13 @@ jobs:
run: make -j2 test

- name: Publish Unit Test Coverage
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
flags: unittests
file: _output/tests/linux_amd64/coverage.txt

local-deploy:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'

Expand Down Expand Up @@ -183,7 +183,7 @@ jobs:
run: make local-deploy

publish-artifacts:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ on:
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
merge_group:
schedule:
- cron: '26 4 * * 2'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: issue_comment

jobs:
backport:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/backport')
steps:
- name: Extract Command
Expand All @@ -24,7 +24,7 @@ jobs:
fetch-depth: 0

- name: Open Backport PR
uses: zeebe-io/backport-action@v3.0.2
uses: zeebe-io/backport-action@v3.2.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_workspace: ${{ github.workspace }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
create-tag:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: Checkout
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/update-terraform-provider.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Update Terraform Provider

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch: {}

jobs:
update-terraform-provider:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Check for New Terraform Provider Release
id: check_release
run: ./scripts/check_version.sh

- name: Read Current Terraform Provider Version from Makefile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to have the full workflow inside a script so that it can be launched locally even if github action is down

id: current_version
run: |
current_version=$(awk -F ' := ' '/TERRAFORM_PROVIDER_VERSION/{print $2}' Makefile)
echo "Current version: $current_version"
echo "current_version=$current_version" >> $GITHUB_ENV

- name: Update Makefile
if: env.new_version != env.current_version
run: |
new_version="${{ env.new_version }}"
sed -i "s/TERRAFORM_PROVIDER_VERSION := .*/TERRAFORM_PROVIDER_VERSION := $new_version/" Makefile
sed -i "s/TERRAFORM_NATIVE_PROVIDER_BINARY := terraform-provider-scaleway_v.*/TERRAFORM_NATIVE_PROVIDER_B

- name: Read Current Provider Metadata
run: |
echo "CURRENT_METADATA=$(cat config/provider-metadata.yaml)" >> $GITHUB_ENV

- name: Update Provider Metadata
run: make generate

- name: Read New Provider Metadata
run: |
echo "NEW_METADATA=$(cat config/provider-metadata.yaml)" >> $GITHUB_ENV

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.22'

- name: Compare Provider Metadata
id: compare_provider_metadata
run: echo "::set-output name=resource_configs::$(go run ./config/tools/comparator/main.go)"

- name: Generate Configurations for New Resources
run: echo ${{ steps.compare_provider_metadata.outputs.resource_configs }} | go run ./config/tools/generator/main.go

- name: Commit and Push Changes
if: env.new_version != env.current_version || steps.compare_provider_metadata.outputs.new_resources
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Update Terraform provider to ${{ env.new_version }} and generate new resources"
branch: ${{ github.head_ref }}
Loading