-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Fernando-Dourado/fernando/gitx
Added support for Git Experience folder convention and Inputsets
- Loading branch information
Showing
5 changed files
with
189 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,71 @@ | ||
package harness | ||
|
||
func GetPipelineFilePath(customGitDetailsFilePath string, p Project, pipeline PipelineContent) string { | ||
import ( | ||
"fmt" | ||
) | ||
|
||
func GetPipelineFilePath(gitX bool, customGitDetailsFilePath string, p Project, pipeline PipelineContent) string { | ||
if len(customGitDetailsFilePath) == 0 { | ||
if gitX { | ||
return fmt.Sprintf(".harness/orgs/%s/projects/%s/pipelines/%s.yaml", string(p.OrgIdentifier), p.Identifier, pipeline.Identifier) | ||
} | ||
return "pipelines/" + string(p.OrgIdentifier) + "/" + p.Identifier + "/" + pipeline.Identifier + ".yaml" | ||
} else { | ||
return customGitDetailsFilePath + "/" + pipeline.Identifier + ".yaml" | ||
} | ||
} | ||
|
||
func GetTemplateFilePath(customGitDetailsFilePath string, p Project, template Template) string { | ||
func GetTemplateFilePath(gitX bool, customGitDetailsFilePath string, p Project, template Template) string { | ||
if len(customGitDetailsFilePath) == 0 { | ||
if gitX { | ||
return fmt.Sprintf(".harness/orgs/%s/projects/%s/templates/%s/%s.yaml", string(p.OrgIdentifier), p.Identifier, template.Identifier, template.VersionLabel) | ||
} | ||
return "templates/" + string(p.OrgIdentifier) + "/" + p.Identifier + "/" + template.Identifier + "-" + template.VersionLabel + ".yaml" | ||
} else { | ||
return customGitDetailsFilePath + "/" + template.Identifier + "-" + template.VersionLabel + ".yaml" | ||
} | ||
} | ||
|
||
func GetServiceFilePath(customGitDetailsFilePath string, p Project, service ServiceClass) string { | ||
func GetServiceFilePath(gitX bool, customGitDetailsFilePath string, p Project, service ServiceClass) string { | ||
if len(customGitDetailsFilePath) == 0 { | ||
if gitX { | ||
return fmt.Sprintf(".harness/orgs/%s/projects/%s/services/%s.yaml", string(p.OrgIdentifier), p.Identifier, service.Identifier) | ||
} | ||
return "services/" + string(p.OrgIdentifier) + "/" + p.Identifier + "/" + service.Identifier + ".yaml" | ||
} else { | ||
return customGitDetailsFilePath + "/" + service.Identifier + ".yaml" | ||
} | ||
} | ||
|
||
func GetEnvironmentFilePath(customGitDetailsFilePath string, p Project, env EnvironmentClass) string { | ||
func GetEnvironmentFilePath(gitX bool, customGitDetailsFilePath string, p Project, env EnvironmentClass) string { | ||
if len(customGitDetailsFilePath) == 0 { | ||
if gitX { | ||
return fmt.Sprintf(".harness/orgs/%s/projects/%s/environments/%s.yaml", string(p.OrgIdentifier), p.Identifier, env.Identifier) | ||
} | ||
return "environments/" + string(p.OrgIdentifier) + "/" + p.Identifier + "/" + env.Identifier + ".yaml" | ||
} else { | ||
return customGitDetailsFilePath + "/" + env.Identifier + ".yaml" | ||
} | ||
} | ||
|
||
func GetInfrastructureFilePath(customGitDetailsFilePath string, p Project, env EnvironmentClass, infraDef Infrastructure) string { | ||
func GetInfrastructureFilePath(gitX bool, customGitDetailsFilePath string, p Project, env EnvironmentClass, infraDef Infrastructure) string { | ||
if len(customGitDetailsFilePath) == 0 { | ||
if gitX { | ||
return fmt.Sprintf(".harness/orgs/%s/projects/%s/environments/%s/infrastructures/%s.yaml", string(p.OrgIdentifier), p.Identifier, env.Identifier, infraDef.Identifier) | ||
} | ||
return "environments/" + string(p.OrgIdentifier) + "/" + p.Identifier + "/" + env.Identifier + "-" + infraDef.Identifier + ".yaml" | ||
} else { | ||
return customGitDetailsFilePath + "/" + env.Identifier + "-" + infraDef.Identifier + ".yaml" | ||
} | ||
} | ||
|
||
func GetInputsetFilePath(gitX bool, customGitDetailsFilePath string, p Project, is *InputsetContent) string { | ||
if len(customGitDetailsFilePath) == 0 { | ||
if gitX { | ||
return fmt.Sprintf(".harness/orgs/%s/projects/%s/pipelines/%s/input_sets/%s.yaml", string(p.OrgIdentifier), p.Identifier, is.PipelineIdentifier, is.Identifier) | ||
} | ||
return "input_sets/" + string(p.OrgIdentifier) + "/" + p.Identifier + "/" + is.PipelineIdentifier + "/" + is.Identifier + ".yaml" | ||
} else { | ||
return customGitDetailsFilePath + "/" + is.PipelineIdentifier + "/" + is.Identifier + ".yaml" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package harness | ||
|
||
type ListInputsetResponse struct { | ||
Status string `json:"status"` | ||
Data ListInputsetData `json:"data"` | ||
CorrelationID string `json:"correlationId"` | ||
} | ||
|
||
type ListInputsetData struct { | ||
TotalPages int64 `json:"totalPages"` | ||
TotalItems int64 `json:"totalItems"` | ||
PageItemCount int64 `json:"pageItemCount"` | ||
PageSize int64 `json:"pageSize"` | ||
Content []*InputsetContent `json:"content"` | ||
PageIndex int64 `json:"pageIndex"` | ||
Empty bool `json:"empty"` | ||
} | ||
|
||
type InputsetContent struct { | ||
Identifier string `json:"identifier"` | ||
Name string `json:"name"` | ||
PipelineIdentifier string `json:"pipelineIdentifier"` | ||
InputSetType string `json:"inputSetType"` | ||
EntityValidityDetails EntityValidityDetails `json:"entityValidityDetails"` | ||
StoreType string `json:"storeType"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters