Skip to content

Commit

Permalink
upgrade* jenkins runtime vars use envVars uniformly
Browse files Browse the repository at this point in the history
  • Loading branch information
colynn committed Nov 26, 2021
1 parent 5255a97 commit 208f180
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 14 deletions.
8 changes: 1 addition & 7 deletions jenkins/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ import "github.com/go-atomci/workflow"

// CommonContext ..
type CommonContext struct {
JenkinsSlaveWorkspace string
AccessToken string
RepoCnf string
AtomCIServer string
Namespace string
}

// CallbackRequest ..
Expand Down Expand Up @@ -58,9 +55,6 @@ type ContainerEnv struct {
// CIContext ..
type CIContext struct {
CommonContext
RegistryAddr string
DockerConfig string
DockerAuth string
Stages string
EnvVars []EnvItem
ContainerTemplates []ContainerEnv
Expand Down
1 change: 0 additions & 1 deletion jenkins/jenkins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func TestGetStatus(t *testing.T) {
pipelineStagesStr := strings.Join(taskPipelineXMLStrArr, " ")

CIContext := CIContext{
RegistryAddr: "",
EnvVars: []EnvItem{
{Key: "JENKINS_SLAVE_WORKSPACE", Value: "/tmp"},
{Key: "ACCESS_TOKEN", Value: "dddxxx"},
Expand Down
2 changes: 1 addition & 1 deletion jenkins/templates/cipipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pipeline {
apiVersion: v1
kind: Pod
metadata:
namespace: devops
namespace: {{ .Namespace }}
spec:
containers:
{{- range $i, $item := .ContainerTemplates }}
Expand Down
2 changes: 1 addition & 1 deletion jenkins/templates/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pipeline {
apiVersion: v1
kind: Pod
metadata:
namespace: devops
namespace: {{ .Namespace }}
spec:
containers:
{{- range $i, $item := .ContainerTemplates }}
Expand Down
5 changes: 1 addition & 4 deletions sample/sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,11 @@ func SamplePipeline(addr, user, token string) error {
// Notes
// pipelineStageStr: you can use `jenkins.GeneratePipelineXMLStr()` get the defined of pipelineXmlStr.
flowProcessor := &jenkins.CIContext{
RegistryAddr: "192.168.2.10:5000",
EnvVars: envVars,
ContainerTemplates: containerTemplates,
Stages: GetPipelineXMLStr(),
CommonContext: jenkins.CommonContext{
JenkinsSlaveWorkspace: "CIInfo[3]",
AccessToken: "adminToken",
AtomCIServer: "atomciServer",
Namespace: "devops",
},
CallBack: jenkins.CallbackRequest{
Token: token,
Expand Down

0 comments on commit 208f180

Please sign in to comment.