-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: automate Crossplane generation process #26
Open
yfodil
wants to merge
28
commits into
scaleway:main
Choose a base branch
from
yfodil:feat/automate_generation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
3ee96b6
add update terraform provider version action
yfodil 50f58cc
use github cli to fetch last terraform provider release
yfodil 8a248ef
add provider metadata comparator
yfodil 0a4af09
add resource generator
yfodil 15f6726
update action
yfodil d46a4ba
go.mod
yfodil 89b0d52
add types file
yfodil 0802b32
refactor to reduce cyclomatic complexity
yfodil 18bde1a
set golangci lint version to latest
yfodil cbe3a14
Merge branch 'main' into feat/automate_generation
yfodil 5f8c834
Merge branch 'main' into feat/automate_generation
yfodil 4662a7c
move templates to a separate file
yfodil 8b4dac9
set go to 1.22
yfodil 7c8df0b
go mod tidy
yfodil f743a84
lint
yfodil b4998a4
Merge branch 'main' into feat/automate_generation
yfodil c5d8a2a
fix Kind fetching
yfodil 14f1242
gofmt the generated files
yfodil 5008cd3
go mod tidy
yfodil a6631a3
fix
yfodil 59ae88a
fix
yfodil 4929cbd
fix
yfodil b0bb34f
fix
yfodil 9c4225e
fix
yfodil f72314e
extract check tf version to a script
yfodil 7b318d2
extract to a func and add tests
yfodil 494988c
fix
yfodil 966132e
Merge branch 'main' into feat/automate_generation
yfodil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
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 | ||
yfodil marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- 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 }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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