- .github
- action
-
cmd
-
flux
-
testdata
- build-kustomization
- check
- cluster_info
- create_secret
- create_source_git
- create_source_helm
- diff-artifact
-
diff-kustomization
- deployment.yaml
- diff-with-deployment.golden
- diff-with-dockerconfigjson-sops-secret.golden
- diff-with-drifted-key-sops-secret.golden
- diff-with-drifted-secret.golden
- diff-with-drifted-service.golden
- diff-with-drifted-stringdata-sops-secret.golden
- diff-with-drifted-value-sops-secret.golden
- dockerconfigjson-sops-secret.yaml
- flux-kustomization-multiobj.yaml
- key-sops-secret.yaml
- kustomization.yaml
- nothing-is-deployed.golden
- secret.yaml
- service.yaml
- stringdata-sops-secret.yaml
- value-sops-secret.yaml
- envsubst
- export
- get
- helmrelease
- image
-
kustomization
- create_kustomization_from_git.golden
- create_source_git.golden
- delete_kustomization_from_git.golden
- get_kustomization_from_git.golden
- reconcile_kustomization_from_git.golden
- resume_kustomization_from_git.golden
- resume_kustomization_from_git_multiple_args.golden
- resume_kustomization_from_git_multiple_args_wait.golden
- suspend_kustomization_from_git.golden
- suspend_kustomization_from_git_multiple_args.golden
- logs
- oci
- trace
- tree
- alert.go
- alert_provider.go
- bootstrap.go
- bootstrap_bitbucket_server.go
- bootstrap_git.go
- bootstrap_gitea.go
- bootstrap_github.go
- bootstrap_gitlab.go
- build.go
- build_artifact.go
- build_artifact_test.go
- build_kustomization.go
- build_kustomization_test.go
- check.go
- check_test.go
- cluster_info.go
- cluster_info_test.go
- completion.go
- completion_bash.go
- completion_fish.go
- completion_powershell.go
- completion_zsh.go
- create.go
- create_alert.go
- create_alertprovider.go
- create_helmrelease.go
- create_image.go
- create_image_policy.go
- create_image_repository.go
- create_image_update.go
- create_kustomization.go
- create_receiver.go
- create_secret.go
- create_secret_git.go
- create_secret_git_test.go
- create_secret_helm.go
- create_secret_helm_test.go
- create_secret_oci.go
- create_secret_oci_test.go
- create_secret_tls.go
- create_secret_tls_test.go
- create_source.go
- create_source_bucket.go
- create_source_git.go
- create_source_git_test.go
- create_source_helm.go
- create_source_helm_test.go
- create_source_oci.go
- create_source_oci_test.go
- create_tenant.go
- create_test.go
- delete.go
- delete_alert.go
- delete_alertprovider.go
- delete_helmrelease.go
- delete_image.go
- delete_image_policy.go
- delete_image_repository.go
- delete_image_update.go
- delete_kustomization.go
- delete_receiver.go
- delete_source.go
- delete_source_bucket.go
- delete_source_git.go
- delete_source_helm.go
- delete_source_oci.go
- diff.go
- diff_artifact.go
- diff_artifact_test.go
- diff_kustomization.go
- diff_kustomization_test.go
- docgen.go
- envsubst.go
- envsubst_test.go
- events.go
- events_test.go
- export.go
- export_alert.go
- export_alertprovider.go
- export_helmrelease.go
- export_image.go
- export_image_policy.go
- export_image_repository.go
- export_image_update.go
- export_kustomization.go
- export_receiver.go
- export_secret.go
- export_source.go
- export_source_bucket.go
- export_source_git.go
- export_source_helm.go
- export_source_oci.go
- export_test.go
- get.go
- get_alert.go
- get_alertprovider.go
- get_all.go
- get_helmrelease.go
- get_image.go
- get_image_all.go
- get_image_policy.go
- get_image_repository.go
- get_image_update.go
- get_kustomization.go
- get_receiver.go
- get_source.go
- get_source_all.go
- get_source_bucket.go
- get_source_chart.go
- get_source_git.go
- get_source_helm.go
- get_source_oci.go
- get_test.go
- helmrelease.go
- helmrelease_test.go
- image.go
- image_test.go
- install.go
- install_test.go
- kustomization.go
- kustomization_test.go
- list.go
- list_artifact.go
- log.go
- logs.go
- logs_e2e_test.go
- logs_unit_test.go
- main.go
- main_e2e_test.go
- main_test.go
- main_unit_test.go
- manifests.embed.go
- object.go
- pull.go
- pull_artifact.go
- push.go
- push_artifact.go
- readiness.go
- readiness_test.go
- receiver.go
- reconcile.go
- reconcile_helmrelease.go
- reconcile_image.go
- reconcile_image_repository.go
- reconcile_image_updateauto.go
- reconcile_kustomization.go
- reconcile_receiver.go
- reconcile_source.go
- reconcile_source_bucket.go
- reconcile_source_chart.go
- reconcile_source_git.go
- reconcile_source_helm.go
- reconcile_source_oci.go
- reconcile_with_source.go
- resume.go
- resume_alert.go
- resume_alertprovider.go
- resume_helmrelease.go
- resume_image.go
- resume_image_repository.go
- resume_image_updateauto.go
- resume_kustomization.go
- resume_receiver.go
- resume_source.go
- resume_source_bucket.go
- resume_source_chart.go
- resume_source_git.go
- resume_source_helm.go
- resume_source_oci.go
- source.go
- source_oci_test.go
- stats.go
- status.go
- suspend.go
- suspend_alert.go
- suspend_alertprovider.go
- suspend_helmrelease.go
- suspend_image.go
- suspend_image_repository.go
- suspend_image_updateauto.go
- suspend_kustomization.go
- suspend_receiver.go
- suspend_source.go
- suspend_source_bucket.go
- suspend_source_chart.go
- suspend_source_git.go
- suspend_source_helm.go
- suspend_source_oci.go
- tag.go
- tag_artifact.go
- trace.go
- trace_test.go
- tree.go
- tree_kustomization.go
- tree_kustomization_test.go
- uninstall.go
- version.go
- version_test.go
- version_utils.go
- version_utils_test.go
-
testdata
-
flux
- docs
- install
-
internal
- build
-
flags
- crds.go
- crds_test.go
- decryption_provider.go
- decryption_provider_test.go
- ecdsa_curve.go
- ecdsa_curve_test.go
- helm_chart_source.go
- helm_chart_source_test.go
- kustomization_source.go
- kustomization_source_test.go
- log_level.go
- log_level_test.go
- public_key_algorithm.go
- public_key_algorithm_test.go
- rsa_key_bits.go
- rsa_key_bits_test.go
- safe_relative_path.go
- safe_relative_path_test.go
- source_bucket_provider.go
- source_bucket_provider_test.go
- source_oci_provider.go
- source_oci_verify_provider.go
- source_oci_verify_provider_test.go
- tree
- utils
-
manifests
- bases
- crds
- install
- integrations
- monitoring
- openshift
- policies
- rbac
- scripts
- pkg
- rfcs
- tests
- .gitignore
- .goreleaser.yml
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- DCO
- Dockerfile
- LICENSE
- MAINTAINERS
- Makefile
- README.md
- go.mod
- go.sum
- netlify.toml
Explanation
This code automates the creation of a commit in a GitHub repository. It reads two YAML files, “kustomization.yaml” and “auto.yaml”, and uses them to create a commit with the specified files in a GitHub repository.
Here’s a breakdown:
- Initialization:
- It reads the contents of “kustomization.yaml” and “auto.yaml” into
ks
andauto
variables, respectively. - It defines two
gitprovider.CommitFile
structs,commitFiles
, containing the paths and content of the files to be committed.
- GitHub Client Setup:
- It retrieves the GitHub organization name (
GITHUB_ORG_NAME
), repository name (GITHUB_REPO_NAME
), and access token (github.TokenVariable
) from environment variables. - It creates a new GitHub client using the provided access token.
- Repository Retrieval:
- It defines the target repository using
gitprovider.OrgRepositoryRef
with the retrieved organization and repository names. - It uses a retry mechanism to fetch the repository from the GitHub API, handling potential network errors.
- Commit Creation:
- It uses the retrieved repository object to create a new commit on the
main
branch. The commit message is set to “automation test”, and thecommitFiles
array is provided as the content of the commit.
In summary, this code is designed to automate the process of creating a commit with pre-defined files in a GitHub repository, using the GitHub API and environment variables to configure the repository and access credentials.
Graph
The graph shows the usage of functions within the codebase.
Select a code symbol to view it's graph