|
|
@@ -79,13 +79,13 @@ func (g *GithubActions) Setup() (string, error) {
|
|
|
return "", err
|
|
|
}
|
|
|
|
|
|
- err = g.createGithubSecret(client, g.getPorterProjectIDSecretName(), g.PorterToken)
|
|
|
+ err = g.createGithubSecret(client, g.getProjectIDSecretName(), g.PorterToken)
|
|
|
|
|
|
if err != nil {
|
|
|
return "", err
|
|
|
}
|
|
|
|
|
|
- err = g.createGithubSecret(client, g.getPorterClusterIDSecretName(), g.PorterToken)
|
|
|
+ err = g.createGithubSecret(client, g.getClusterIDSecretName(), g.PorterToken)
|
|
|
|
|
|
if err != nil {
|
|
|
return "", err
|
|
|
@@ -144,11 +144,18 @@ func (g *GithubActions) Cleanup() error {
|
|
|
return g.deleteGithubFile(client, g.getPorterYMLFileName())
|
|
|
}
|
|
|
|
|
|
+type GithubActionEnvConfig struct {
|
|
|
+ PorterToken string `yaml:"PORTER_TOKEN"`
|
|
|
+ ProjectID string `yaml:"PORTER_PROJECT"`
|
|
|
+ ClusterID string `yaml:"PORTER_CLUSTER"`
|
|
|
+}
|
|
|
+
|
|
|
type GithubActionYAMLStep struct {
|
|
|
- Name string `yaml:"name,omitempty"`
|
|
|
- ID string `yaml:"id,omitempty"`
|
|
|
- Uses string `yaml:"uses,omitempty"`
|
|
|
- Run string `yaml:"run,omitempty"`
|
|
|
+ Name string `yaml:"name,omitempty"`
|
|
|
+ ID string `yaml:"id,omitempty"`
|
|
|
+ Uses string `yaml:"uses,omitempty"`
|
|
|
+ Run string `yaml:"run,omitempty"`
|
|
|
+ Env GithubActionEnvConfig `yaml:"env,omitempty"`
|
|
|
}
|
|
|
|
|
|
type GithubActionYAMLOnPushBranches struct {
|
|
|
@@ -176,16 +183,16 @@ func (g *GithubActions) GetGithubActionYAML() ([]byte, error) {
|
|
|
gaSteps := []GithubActionYAMLStep{
|
|
|
getCheckoutCodeStep(),
|
|
|
getDownloadPorterStep(),
|
|
|
- getConfigurePorterStep(g.ServerURL, g.getPorterTokenSecretName()),
|
|
|
- }
|
|
|
-
|
|
|
- if g.DockerFilePath == "" {
|
|
|
- gaSteps = append(gaSteps, getBuildPackPushStep(g.getBuildEnvSecretName(), g.FolderPath, g.ImageRepoURL))
|
|
|
- } else {
|
|
|
- gaSteps = append(gaSteps, getDockerBuildPushStep(g.getBuildEnvSecretName(), g.DockerFilePath, g.ImageRepoURL))
|
|
|
+ getConfigurePorterStep(g.ServerURL, g.getPorterTokenSecretName(), g.getProjectIDSecretName(), g.getClusterIDSecretName(), g.ReleaseName),
|
|
|
}
|
|
|
|
|
|
- gaSteps = append(gaSteps, deployPorterWebhookStep(g.ServerURL, g.getWebhookSecretName()))
|
|
|
+ //if g.DockerFilePath == "" {
|
|
|
+ // gaSteps = append(gaSteps, getBuildPackPushStep(g.getBuildEnvSecretName(), g.FolderPath, g.ImageRepoURL))
|
|
|
+ //} else {
|
|
|
+ // gaSteps = append(gaSteps, getDockerBuildPushStep(g.getBuildEnvSecretName(), g.DockerFilePath, g.ImageRepoURL))
|
|
|
+ //}
|
|
|
+ //
|
|
|
+ //gaSteps = append(gaSteps, deployPorterWebhookStep(g.ServerURL, g.getWebhookSecretName()))
|
|
|
|
|
|
branch := g.GitBranch
|
|
|
|
|
|
@@ -358,11 +365,11 @@ func (g *GithubActions) getPorterTokenSecretName() string {
|
|
|
return fmt.Sprintf("PORTER_TOKEN_%d", g.ProjectID)
|
|
|
}
|
|
|
|
|
|
-func (g *GithubActions) getPorterProjectIDSecretName() string {
|
|
|
+func (g *GithubActions) getProjectIDSecretName() string {
|
|
|
return fmt.Sprintf("PORTER_PROJECT_ID_%d", g.ProjectID)
|
|
|
}
|
|
|
|
|
|
-func (g *GithubActions) getPorterClusterIDSecretName() string {
|
|
|
+func (g *GithubActions) getClusterIDSecretName() string {
|
|
|
return fmt.Sprintf("PORTER_CLUSTER_ID_%d", g.ProjectID)
|
|
|
}
|
|
|
|