mirror of https://github.com/harness/drone.git
feat: [CDE-153]: Cloning the code inside the Gitspace using the given branch. (#2220)
* feat: [CDE-153]: Cloning the code inside the Gitspace using the given branch.unified-ui
parent
2785206535
commit
8315560180
|
@ -383,12 +383,14 @@ func (e *EmbeddedDockerOrchestrator) cloneCode(
|
|||
RepoURL: gitspaceConfig.CodeRepoURL,
|
||||
DevcontainerPresent: devcontainerPresent,
|
||||
Image: e.config.DefaultBaseImage,
|
||||
Branch: gitspaceConfig.Branch,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to generate scipt to clone git from template %s: %w", templateCloneGit, err)
|
||||
}
|
||||
|
||||
loggingErr := logStreamInstance.Write("Cloning git repo inside container: " + gitspaceConfig.CodeRepoURL)
|
||||
loggingErr := logStreamInstance.Write(
|
||||
"Cloning git repo inside container: " + gitspaceConfig.CodeRepoURL + " branch: " + gitspaceConfig.Branch)
|
||||
if loggingErr != nil {
|
||||
return fmt.Errorf("logging error: %w", loggingErr)
|
||||
}
|
||||
|
@ -520,7 +522,7 @@ func (e *EmbeddedDockerOrchestrator) createContainer(
|
|||
)
|
||||
|
||||
loggingErr := logStreamInstance.Write(
|
||||
"Creating bind mount source directory: " + bindMountSourcePath + " (" + absoluteBindMountSourcePath + " )")
|
||||
"Creating bind mount source directory: " + bindMountSourcePath + " (" + absoluteBindMountSourcePath + ")")
|
||||
if loggingErr != nil {
|
||||
return fmt.Errorf("logging error: %w", loggingErr)
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ type CloneGitPayload struct {
|
|||
RepoURL string
|
||||
DevcontainerPresent string
|
||||
Image string
|
||||
Branch string
|
||||
}
|
||||
|
||||
type RunVSCodeWebPayload struct {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
repo_url={{ .RepoURL }}
|
||||
devcontainer_present={{ .DevcontainerPresent }}
|
||||
image={{ .Image }}
|
||||
branch={{ .Branch }}
|
||||
|
||||
# Extract the repository name from the URL
|
||||
repo_name=$(basename -s .git "$repo_url")
|
||||
|
@ -22,7 +23,7 @@ fi
|
|||
# Clone the repository only if it doesn't exist
|
||||
if [ ! -d "$repo_name" ]; then
|
||||
echo "Cloning the repository..."
|
||||
git clone "$repo_url"
|
||||
git clone "$repo_url" --branch "$branch"
|
||||
else
|
||||
echo "Repository already exists. Skipping clone."
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue