Skip to content

Commit

Permalink
added option to mention branch on git repository
Browse files Browse the repository at this point in the history
  • Loading branch information
akrami committed Jul 6, 2024
1 parent 5720f8b commit 882ef57
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
"dependency": [
"wordpress"
]
},
{
"name": "postgres",
"repository": "https://github.com/ChristianLempa/boilerplates.git",
"branch": "ansible-hosts-variable-removal",
"path": "docker-compose/postgres/docker-compose.yaml"
}
],
"dependency": {
Expand Down
6 changes: 5 additions & 1 deletion internal/docker/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ func (project *Project) Start() error {
}
copyutil.CopyDir(filesys.MakeFsOnDisk(), srcDir, getAbsoluteProjectPath(*project))
} else {
_, execErr := GitExec("clone", project.Repository, getAbsoluteProjectPath(*project))
gitArgs := []string{"clone", project.Repository, getAbsoluteProjectPath(*project)}
if project.Branch != "" {
gitArgs = append(gitArgs, "-b", project.Branch)
}
_, execErr := GitExec(gitArgs...)
if execErr != nil {
return errors.Join(errors.New("git exec error"), execErr)
}
Expand Down
1 change: 1 addition & 0 deletions internal/docker/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type Project struct {
Name string `json:"name"`
Local string `json:"local"`
Repository string `json:"repository"`
Branch string `json:"branch"`
Path string `json:"path"`
PreAction []string `json:"pre-action"`
PostAction []string `json:"post-action"`
Expand Down

0 comments on commit 882ef57

Please sign in to comment.