From 7b6f49b10f43b9cda2646e3d2f040f8d6b02c2e1 Mon Sep 17 00:00:00 2001 From: BrunoQuaresma Date: Thu, 1 Aug 2024 13:15:37 +0000 Subject: [PATCH 1/3] docs: cloning git repositories --- docs/guides/cloning-git-repositories.md | 66 +++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 docs/guides/cloning-git-repositories.md diff --git a/docs/guides/cloning-git-repositories.md b/docs/guides/cloning-git-repositories.md new file mode 100644 index 0000000000000..a1822728a5432 --- /dev/null +++ b/docs/guides/cloning-git-repositories.md @@ -0,0 +1,66 @@ +# Cloning Git Repositories + +
+ Author: + + Bruno Quaresma + + +
+August 01, 2024 + +--- + +When starting to work on a project, engineers usually need to clone a Git +repository. Even though this is often a quick step, Coder can automate it to +make the flow more seamless, creating workspaces ready for development and +reducing onboarding time. + +The first step to enable Coder to clone a repository is to provide +authorization. This can be achieved by using the Git provider, such as GitHub, +as an authentication method. If you don't know how to do that, we have written +documentation to help you: [Authentication with GitHub](/admin/auth#github). + +With the authentication in place, it is time to set up the template to use the +[Git Clone module](https://registry.coder.com/modules/git-clone) from the +[Coder Registry](https://registry.coder.com/) by adding it to our template's +Terraform configuration. + +```hcl +module "git-clone" { + source = "registry.coder.com/modules/git-clone/coder" + version = "1.0.12" + agent_id = coder_agent.example.id + url = "https://github.com/coder/coder" +} +``` + +> You can edit the template using an IDE or terminal of your preference, or by +> going into the [template editor UI](/templates/creating#editing-templates). + +You can also use [template parameters](/templates/parameters) to customize the +Git URL and make it dynamic for use cases where a template supports multiple +projects. + +```hcl +data "coder_parameter" "git_repo" { + name = "git_repo" + display_name = "Git repository" + default = "https://github.com/coder/coder" +} + +module "git-clone" { + source = "registry.coder.com/modules/git-clone/coder" + version = "1.0.12" + agent_id = coder_agent.example.id + url = data.coder_parameter.git_repo.value +} +``` + +> If you need more customization, you can read the +> [Git Clone module](https://registry.coder.com/modules/git-clone) documentation +> to learn more about the module. + +Don't forget to build and publish the template changes before creating a new +workspace. You can check if the repository is cloned by accessing the workspace +terminal and listing the directories. From 5cac11187dcd6da69aec4d4df1d2d49b229fbca2 Mon Sep 17 00:00:00 2001 From: BrunoQuaresma Date: Tue, 6 Aug 2024 14:33:09 +0000 Subject: [PATCH 2/3] Apply fixes --- docs/guides/cloning-git-repositories.md | 21 ++++++++++++--------- docs/manifest.json | 5 +++++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/docs/guides/cloning-git-repositories.md b/docs/guides/cloning-git-repositories.md index a1822728a5432..75356f288d415 100644 --- a/docs/guides/cloning-git-repositories.md +++ b/docs/guides/cloning-git-repositories.md @@ -2,24 +2,25 @@
Author: - + Bruno Quaresma
-August 01, 2024 +August 06, 2024 --- When starting to work on a project, engineers usually need to clone a Git -repository. Even though this is often a quick step, Coder can automate it to -make the flow more seamless, creating workspaces ready for development and -reducing onboarding time. +repository. Even though this is often a quick step, it can be automated using +the [Coder Registry](https://registry.coder.com/) to make a seamless Git-first +workflow. The first step to enable Coder to clone a repository is to provide authorization. This can be achieved by using the Git provider, such as GitHub, as an authentication method. If you don't know how to do that, we have written -documentation to help you: [Authentication with GitHub](/admin/auth#github). +documentation to help you: +[Authentication with GitHub](https://coder.com/docs/admin/auth#github). With the authentication in place, it is time to set up the template to use the [Git Clone module](https://registry.coder.com/modules/git-clone) from the @@ -36,10 +37,12 @@ module "git-clone" { ``` > You can edit the template using an IDE or terminal of your preference, or by -> going into the [template editor UI](/templates/creating#editing-templates). +> going into the +> [template editor UI](https://coder.com/docs/templates/creating#editing-templates). -You can also use [template parameters](/templates/parameters) to customize the -Git URL and make it dynamic for use cases where a template supports multiple +You can also use +[template parameters](https://coder.com/docs/templates/parameters) to customize +the Git URL and make it dynamic for use cases where a template supports multiple projects. ```hcl diff --git a/docs/manifest.json b/docs/manifest.json index 82dd73ada47c8..cc70ff1acbb32 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1164,6 +1164,11 @@ "title": "Scanning Coder Workspaces with JFrog Xray", "description": "Integrate Coder with JFrog Xray", "path": "./guides/xray-integration.md" + }, + { + "title": "Cloning Git Repositories", + "description": "Integrate Coder with Git", + "path": "./guides/cloning-git-repositories.md" } ] } From 21789623d6bbd7da8641f56f346a39fda8fc36e4 Mon Sep 17 00:00:00 2001 From: BrunoQuaresma Date: Tue, 6 Aug 2024 15:27:02 +0000 Subject: [PATCH 3/3] Apply suggestions --- docs/guides/cloning-git-repositories.md | 5 ++++- docs/manifest.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/guides/cloning-git-repositories.md b/docs/guides/cloning-git-repositories.md index 75356f288d415..40813f249277a 100644 --- a/docs/guides/cloning-git-repositories.md +++ b/docs/guides/cloning-git-repositories.md @@ -20,7 +20,10 @@ The first step to enable Coder to clone a repository is to provide authorization. This can be achieved by using the Git provider, such as GitHub, as an authentication method. If you don't know how to do that, we have written documentation to help you: -[Authentication with GitHub](https://coder.com/docs/admin/auth#github). + +- [GitHub](https://coder.com/docs/admin/auth#github) +- [GitLab self-managed](https://coder.com/docs/admin/external-auth#gitlab-self-managed) +- [Self-managed git providers](https://coder.com/docs/admin/external-auth#self-managed-git-providers) With the authentication in place, it is time to set up the template to use the [Git Clone module](https://registry.coder.com/modules/git-clone) from the diff --git a/docs/manifest.json b/docs/manifest.json index cc70ff1acbb32..6fe08f10191d2 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1167,7 +1167,7 @@ }, { "title": "Cloning Git Repositories", - "description": "Integrate Coder with Git", + "description": "Automatically clone Git repositories into your workspace", "path": "./guides/cloning-git-repositories.md" } ]