This quick start guide is designed for new Codefresh accounts or accounts with no GitOps Runtimes installed. This guide utilizes GitHub Codespaces, which is free for ~30 hours a month based on the settings needed, to make this guide available for users with Chromebooks, low-powered devices, tablets, and any other devices with a modern browser and internet connection.
If you want to use your local device, below are the requirements.
- Select "Use this template" > "Create a new repository".
- Once the repository is created, navigate to the settings tab.
- Click "Secrets and variables" > Codespaces on the left side.
- From there, we are going to add two variables.
TF_VAR_CF_API_KEY
: A Codefresh API Key with All Scopes.TF_VAR_GITHUB_PAT
: A Personal access tokens (classic) with the scopes ofadmin:repo_hook, delete_repo, read:org, repo
.
- Once added, navigate back to the "Code" tab.
- Select the green "Code" button > "Codespaces" tab > "Create codespace on main."
- Once the Codespace is up and running, open the terminal.
- Navigate to the "codefresh" directory:
cd codefresh
. - Initialize the project by running
tofu init
. - Now we are going to apply the configuration by running
tofu apply
. - Type in "yes" to approve the creation of resources.
- Once completed, everything should be up and running. For more details, refer to Resources Being Created.
To clean up the created resources, run the following command in the ./codefresh
directory. When asked to confirm, type "yes."
tofu apply --destroy
The following items are resources created by the OpenTofu/Terraform code based on the file names.
- A Hybrid Pipelines Runtime
- A Codefresh Project
- A Codefresh Pipeline
- A Git Pipelines Integration
- A repository name "codefresh-isc"
- A repository name "codefresh-apps"
- A Git Source
- A sample Argo CD application
- Configures the GitOps Git Provider
- A Hybrid GitOps Runtime
- Adds a Git Personal Token to the runtime
- a minikube kubernetes cluster
The OpenTofu/Terraform codes use the local backend for their state. If the Codespace is ever destroyed, you will lose the state of the resources. You will then need to manually delete the resources it has created to use this code again. You can modify the back end in the ./codefresh/main.tf
file.