Skip to content

Commit

Permalink
fix: delete project name in workflow pod env (#1509)
Browse files Browse the repository at this point in the history
PROJECT_NAME is a very likely conflict word with other systems,
like ourselves SonarQube scanner program,do not inject it as an
Env into the WorkflowRun pod.

TODO:
- change the Env key name(add a prefix like CYCLONE_PROJECT_NAME)
and inject it in the future.
  • Loading branch information
zhujian7 authored Oct 15, 2020
1 parent 50c9fd9 commit 9f145c8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions pkg/workflow/common/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ const (
EnvWorkflowRunInfo = "WORKFLOWRUN_INFO"
// EnvOutputResourcesInfo is an environment which represents output resources information.
EnvOutputResourcesInfo = "OUTPUT_RESOURCES_INFO"
// EnvProjectName is an environment which represents project name.
EnvProjectName = "PROJECT_NAME"

// // EnvProjectName is an environment which represents project name.
// EnvProjectName = "PROJECT_NAME"

// EnvWorkflowName is an environment which represents workflow name.
EnvWorkflowName = "WORKFLOW_NAME"
// EnvWorkflowrunName is an environment which represents workflowrun name.
Expand Down
8 changes: 4 additions & 4 deletions pkg/workflow/workload/pod/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -843,10 +843,10 @@ func (m *Builder) AddCoordinator() error {
// stage name, namespace.
func (m *Builder) InjectEnvs() error {
envs := []corev1.EnvVar{
{
Name: common.EnvProjectName,
Value: common.ResolveProjectName(*m.wfr),
},
// {
// Name: common.EnvProjectName,
// Value: common.ResolveProjectName(*m.wfr),
// },
{
Name: common.EnvWorkflowName,
Value: common.ResolveWorkflowName(*m.wfr),
Expand Down
4 changes: 2 additions & 2 deletions pkg/workflow/workload/pod/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@ func (suite *PodBuilderSuite) TestInjectEnvs() {
assert.NotNil(suite.T(), builder.pod.Spec.Containers[0].Env)
for _, kv := range builder.pod.Spec.Containers[0].Env {
switch kv.Name {
case common.EnvProjectName:
assert.Equal(suite.T(), "p1", kv.Value)
// case common.EnvProjectName:
// assert.Equal(suite.T(), "p1", kv.Value)
case common.EnvWorkflowName:
assert.Equal(suite.T(), "wf", kv.Value)
case common.EnvWorkflowrunName:
Expand Down

0 comments on commit 9f145c8

Please sign in to comment.