Skip to content

Commit

Permalink
fix: project path could return a wrong value on gitlab
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippHeuer committed Aug 21, 2024
1 parent 3193862 commit ee845a7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions pkg/normalizer/githubactions/normalize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ func TestNormalizer_Normalize_Project(t *testing.T) {
})

assert.NoError(t, err)
assert.Equal(t, "normalizeci", normalized.Project.Name)
assert.Equal(t, "cidverse/normalizeci", normalized.Project.Path)
assert.Equal(t, "cidverse-normalizeci", normalized.Project.Slug)
assert.Equal(t, "https://github.com/cidverse/cienvsamples", normalized.Project.Url)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/normalizer/gitlabci/normalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (n Normalizer) Normalize(env map[string]string) (v1.Spec, error) {
}
nci.Project.Id = nciutil.FirstNonEmpty([]string{nciutil.GetValueFromMap(env, "CI_PROJECT_ID"), projectData.Id})
nci.Project.Name = nciutil.FirstNonEmpty([]string{nciutil.GetValueFromMap(env, "CI_PROJECT_TITLE"), projectData.Name})
nci.Project.Path = nciutil.FirstNonEmpty([]string{nciutil.GetValueFromMap(env, "CI_PROJECT_NAME"), projectData.Path})
nci.Project.Path = nciutil.FirstNonEmpty([]string{nciutil.GetValueFromMap(env, "CI_PROJECT_PATH"), projectData.Path})
nci.Project.Slug = nciutil.FirstNonEmpty([]string{nciutil.GetValueFromMap(env, "CI_PROJECT_PATH_SLUG"), projectData.Slug})
nci.Project.Description = nciutil.FirstNonEmpty([]string{nciutil.GetValueFromMap(env, "CI_PROJECT_DESCRIPTION"), projectData.Description})
nci.Project.Topics = nciutil.FirstNonEmpty([]string{projectData.Topics})
Expand Down
3 changes: 2 additions & 1 deletion pkg/normalizer/gitlabci/normalize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func TestNormalizer_Normalize_Project(t *testing.T) {
"CI_PROJECT_ID": "35974876",
"CI_PROJECT_TITLE": "cienvsamples",
"CI_PROJECT_NAME": "cienvsamples",
"CI_PROJECT_PATH": "cidverse/cienvsamples",
"CI_PROJECT_PATH_SLUG": "cidverse-cienvsamples",
"CI_PROJECT_DESCRIPTION": "A tool to turn the continuous integration / deployment variables into a common format for generally usable scripts without any dependencies.",
"CI_DEFAULT_BRANCH": "main",
Expand All @@ -100,7 +101,7 @@ func TestNormalizer_Normalize_Project(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, "35974876", normalized.Project.Id)
assert.Equal(t, "cienvsamples", normalized.Project.Name)
assert.Equal(t, "cienvsamples", normalized.Project.Path)
assert.Equal(t, "cidverse/cienvsamples", normalized.Project.Path)
assert.Equal(t, "cidverse-cienvsamples", normalized.Project.Slug)
assert.Equal(t, "A tool to turn the continuous integration / deployment variables into a common format for generally usable scripts without any dependencies.", normalized.Project.Description)
assert.Equal(t, "main", normalized.Project.DefaultBranch)
Expand Down

0 comments on commit ee845a7

Please sign in to comment.