mirror of
https://github.com/semaphoreui/semaphore.git
synced 2025-01-20 15:29:28 +01:00
fix(be): run galaxy install for collections
Issue: https://github.com/ansible-semaphore/semaphore/issues/620
This commit is contained in:
parent
add4b87ab9
commit
7b7ae01add
@ -113,12 +113,33 @@ func (t *task) prepareRun() {
|
||||
return
|
||||
}
|
||||
|
||||
if err := t.runGalaxy(); err != nil {
|
||||
if err := t.runGalaxy([]string{
|
||||
"install",
|
||||
"-r",
|
||||
"roles/requirements.yml",
|
||||
"-p",
|
||||
"./roles/",
|
||||
"--force",
|
||||
}); err != nil {
|
||||
t.log("Running galaxy failed: " + err.Error())
|
||||
t.fail()
|
||||
return
|
||||
}
|
||||
|
||||
if err := t.runGalaxy([]string{
|
||||
"install",
|
||||
"collection",
|
||||
"-r",
|
||||
"roles/requirements.yml",
|
||||
"-p",
|
||||
"./roles/",
|
||||
"--force",
|
||||
}); err != nil {
|
||||
t.log("Running galaxy collection failed: " + err.Error())
|
||||
t.fail()
|
||||
return
|
||||
}
|
||||
|
||||
// todo: write environment
|
||||
|
||||
if stderr, err := t.listPlaybookHosts(); err != nil {
|
||||
@ -328,16 +349,7 @@ func (t *task) updateRepository() error {
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
func (t *task) runGalaxy() error {
|
||||
args := []string{
|
||||
"install",
|
||||
"-r",
|
||||
"roles/requirements.yml",
|
||||
"-p",
|
||||
"./roles/",
|
||||
"--force",
|
||||
}
|
||||
|
||||
func (t *task) runGalaxy(args []string) error {
|
||||
cmd := exec.Command("ansible-galaxy", args...) //nolint: gas
|
||||
cmd.Dir = util.Config.TmpPath + "/repository_" + strconv.Itoa(t.repository.ID)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user