mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-12-04 15:21:05 +01:00
refactor(galaxy): add type and constants
Some checks are pending
Dev / build-local (push) Waiting to run
Dev / migrate-boltdb (push) Blocked by required conditions
Dev / migrate-mysql (push) Blocked by required conditions
Dev / migrate-mariadb (push) Blocked by required conditions
Dev / migrate-postgres (push) Blocked by required conditions
Dev / integrate-boltdb (push) Blocked by required conditions
Dev / integrate-mysql (push) Blocked by required conditions
Dev / integrate-mariadb (push) Blocked by required conditions
Dev / integrate-postgres (push) Blocked by required conditions
Dev / deploy-server (push) Blocked by required conditions
Dev / deploy-runner (push) Blocked by required conditions
Some checks are pending
Dev / build-local (push) Waiting to run
Dev / migrate-boltdb (push) Blocked by required conditions
Dev / migrate-mysql (push) Blocked by required conditions
Dev / migrate-mariadb (push) Blocked by required conditions
Dev / migrate-postgres (push) Blocked by required conditions
Dev / integrate-boltdb (push) Blocked by required conditions
Dev / integrate-mysql (push) Blocked by required conditions
Dev / integrate-mariadb (push) Blocked by required conditions
Dev / integrate-postgres (push) Blocked by required conditions
Dev / deploy-server (push) Blocked by required conditions
Dev / deploy-runner (push) Blocked by required conditions
This commit is contained in:
parent
94f7da8e4a
commit
2a8f7cf884
@ -90,7 +90,7 @@ func (t *AnsibleApp) getRepoPath() string {
|
|||||||
return repo.GetFullPath()
|
return repo.GetFullPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *AnsibleApp) installGalaxyRequirementsFile(requirementsType string, requirementsFilePath string) error {
|
func (t *AnsibleApp) installGalaxyRequirementsFile(requirementsType GalaxyRequirementsType, requirementsFilePath string) error {
|
||||||
|
|
||||||
requirementsHashFilePath := fmt.Sprintf("%s.md5", requirementsFilePath)
|
requirementsHashFilePath := fmt.Sprintf("%s.md5", requirementsFilePath)
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ func (t *AnsibleApp) installGalaxyRequirementsFile(requirementsType string, requ
|
|||||||
|
|
||||||
if hasRequirementsChanges(requirementsFilePath, requirementsHashFilePath) {
|
if hasRequirementsChanges(requirementsFilePath, requirementsHashFilePath) {
|
||||||
if err := t.runGalaxy([]string{
|
if err := t.runGalaxy([]string{
|
||||||
requirementsType,
|
string(requirementsType),
|
||||||
"install",
|
"install",
|
||||||
"-r",
|
"-r",
|
||||||
requirementsFilePath,
|
requirementsFilePath,
|
||||||
@ -125,21 +125,28 @@ func (t *AnsibleApp) GetPlaybookDir() string {
|
|||||||
return path.Dir(playbookPath)
|
return path.Dir(playbookPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GalaxyRequirementsType string
|
||||||
|
|
||||||
|
const (
|
||||||
|
GalaxyRole GalaxyRequirementsType = "role"
|
||||||
|
GalaxyCollection GalaxyRequirementsType = "collection"
|
||||||
|
)
|
||||||
|
|
||||||
func (t *AnsibleApp) installRolesRequirements() (err error) {
|
func (t *AnsibleApp) installRolesRequirements() (err error) {
|
||||||
err = t.installGalaxyRequirementsFile("role", path.Join(t.GetPlaybookDir(), "roles", "requirements.yml"))
|
err = t.installGalaxyRequirementsFile(GalaxyRole, path.Join(t.GetPlaybookDir(), "roles", "requirements.yml"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = t.installGalaxyRequirementsFile("role", path.Join(t.getRepoPath(), "roles", "requirements.yml"))
|
err = t.installGalaxyRequirementsFile(GalaxyRole, path.Join(t.getRepoPath(), "roles", "requirements.yml"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *AnsibleApp) installCollectionsRequirements() (err error) {
|
func (t *AnsibleApp) installCollectionsRequirements() (err error) {
|
||||||
err = t.installGalaxyRequirementsFile("collection", path.Join(t.GetPlaybookDir(), "collections", "requirements.yml"))
|
err = t.installGalaxyRequirementsFile(GalaxyCollection, path.Join(t.GetPlaybookDir(), "collections", "requirements.yml"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = t.installGalaxyRequirementsFile("collection", path.Join(t.getRepoPath(), "collections", "requirements.yml"))
|
err = t.installGalaxyRequirementsFile(GalaxyCollection, path.Join(t.getRepoPath(), "collections", "requirements.yml"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user