forked from kyma-project/kyma
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Asset Metadata Service job (kyma-project#789)
* Add Asset Metadata Service job * Make the job optional
- Loading branch information
Showing
2 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
development/tools/jobs/kyma/asset_metadata_service_test.go
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,83 @@ | ||
package kyma_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/kyma-project/test-infra/development/tools/jobs/tester" | ||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestAssetMetadataServiceReleases(t *testing.T) { | ||
// WHEN | ||
unsupportedReleases := []string{"release-0.6", "release-0.7", "release-0.8"} | ||
|
||
for _, currentRelease := range tester.GetSupportedReleases(unsupportedReleases) { | ||
t.Run(currentRelease, func(t *testing.T) { | ||
jobConfig, err := tester.ReadJobConfig("./../../../../prow/jobs/kyma/components/asset-metadata-service/asset-metadata-service.yaml") | ||
// THEN | ||
require.NoError(t, err) | ||
actualPresubmit := tester.FindPresubmitJobByName(jobConfig.Presubmits["kyma-project/kyma"], tester.GetReleaseJobName("kyma-components-asset-metadata-service", currentRelease), currentRelease) | ||
require.NotNil(t, actualPresubmit) | ||
assert.False(t, actualPresubmit.SkipReport) | ||
assert.True(t, actualPresubmit.Decorate) | ||
assert.Equal(t, "github.com/kyma-project/kyma", actualPresubmit.PathAlias) | ||
tester.AssertThatHasExtraRefTestInfra(t, actualPresubmit.JobBase.UtilityConfig, currentRelease) | ||
tester.AssertThatHasPresets(t, actualPresubmit.JobBase, tester.PresetDindEnabled, tester.PresetDockerPushRepo, tester.PresetGcrPush, tester.PresetBuildRelease) | ||
assert.True(t, actualPresubmit.AlwaysRun) | ||
tester.AssertThatExecGolangBuildpack(t, actualPresubmit.JobBase, tester.ImageGolangBuildpack1_11, "/home/prow/go/src/github.com/kyma-project/kyma/components/asset-metadata-service") | ||
}) | ||
} | ||
} | ||
|
||
func TestAssetMetadataServiceJobPresubmit(t *testing.T) { | ||
// WHEN | ||
jobConfig, err := tester.ReadJobConfig("./../../../../prow/jobs/kyma/components/asset-metadata-service/asset-metadata-service.yaml") | ||
// THEN | ||
require.NoError(t, err) | ||
|
||
expName := "pre-master-kyma-components-asset-metadata-service" | ||
actualPresubmit := tester.FindPresubmitJobByName(jobConfig.Presubmits["kyma-project/kyma"], expName, "master") | ||
require.NotNil(t, actualPresubmit) | ||
assert.Equal(t, expName, actualPresubmit.Name) | ||
assert.Equal(t, []string{"master"}, actualPresubmit.Branches) | ||
|
||
assert.Equal(t, 10, actualPresubmit.MaxConcurrency) | ||
assert.False(t, actualPresubmit.SkipReport) | ||
assert.True(t, actualPresubmit.Decorate) | ||
assert.True(t, actualPresubmit.Optional) // TODO: Change after source code merge | ||
assert.Equal(t, "github.com/kyma-project/kyma", actualPresubmit.PathAlias) | ||
|
||
tester.AssertThatHasExtraRefTestInfra(t, actualPresubmit.JobBase.UtilityConfig, "master") | ||
tester.AssertThatHasPresets(t, actualPresubmit.JobBase, tester.PresetDindEnabled, tester.PresetDockerPushRepo, tester.PresetGcrPush, tester.PresetBuildPr) | ||
assert.Equal(t, "^components/asset-metadata-service/", actualPresubmit.RunIfChanged) | ||
tester.AssertThatJobRunIfChanged(t, *actualPresubmit, "components/asset-metadata-service/some_random_file.go") | ||
tester.AssertThatExecGolangBuildpack(t, actualPresubmit.JobBase, tester.ImageGolangBuildpack1_11, "/home/prow/go/src/github.com/kyma-project/kyma/components/asset-metadata-service") | ||
} | ||
|
||
func TestAssetMetadataServiceJobPostsubmit(t *testing.T) { | ||
// WHEN | ||
jobConfig, err := tester.ReadJobConfig("./../../../../prow/jobs/kyma/components/asset-metadata-service/asset-metadata-service.yaml") | ||
// THEN | ||
require.NoError(t, err) | ||
|
||
assert.Len(t, jobConfig.Postsubmits, 1) | ||
kymaPost, ex := jobConfig.Postsubmits["kyma-project/kyma"] | ||
assert.True(t, ex) | ||
assert.Len(t, kymaPost, 1) | ||
|
||
expName := "post-master-kyma-components-asset-metadata-service" | ||
actualPost := tester.FindPostsubmitJobByName(kymaPost, expName, "master") | ||
require.NotNil(t, actualPost) | ||
assert.Equal(t, expName, actualPost.Name) | ||
assert.Equal(t, []string{"master"}, actualPost.Branches) | ||
|
||
assert.Equal(t, 10, actualPost.MaxConcurrency) | ||
assert.True(t, actualPost.Decorate) | ||
assert.Equal(t, "github.com/kyma-project/kyma", actualPost.PathAlias) | ||
tester.AssertThatHasExtraRefTestInfra(t, actualPost.JobBase.UtilityConfig, "master") | ||
tester.AssertThatHasPresets(t, actualPost.JobBase, tester.PresetDindEnabled, tester.PresetDockerPushRepo, tester.PresetGcrPush, tester.PresetBuildMaster) | ||
assert.Equal(t, "^components/asset-metadata-service/", actualPost.RunIfChanged) | ||
tester.AssertThatJobRunIfChanged(t, *actualPost, "components/asset-metadata-service/some_random_file.go") | ||
tester.AssertThatExecGolangBuildpack(t, actualPost.JobBase, tester.ImageGolangBuildpack1_11, "/home/prow/go/src/github.com/kyma-project/kyma/components/asset-metadata-service") | ||
} |
57 changes: 57 additions & 0 deletions
57
prow/jobs/kyma/components/asset-metadata-service/asset-metadata-service.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,57 @@ | ||
test_infra_ref: &test_infra_ref | ||
org: kyma-project | ||
repo: test-infra | ||
path_alias: github.com/kyma-project/test-infra | ||
|
||
job_template: &job_template | ||
skip_report: false | ||
decorate: true | ||
path_alias: github.com/kyma-project/kyma | ||
max_concurrency: 10 | ||
spec: | ||
containers: | ||
- image: eu.gcr.io/kyma-project/test-infra/buildpack-golang:go1.11 | ||
securityContext: | ||
privileged: true | ||
command: | ||
- "/home/prow/go/src/github.com/kyma-project/test-infra/prow/scripts/build.sh" | ||
args: | ||
- "/home/prow/go/src/github.com/kyma-project/kyma/components/asset-metadata-service" | ||
resources: | ||
requests: | ||
memory: 2Gi | ||
cpu: 1.5 | ||
|
||
job_labels_template: &job_labels_template | ||
preset-dind-enabled: "true" | ||
preset-sa-gcr-push: "true" | ||
preset-docker-push-repository: "true" | ||
|
||
presubmits: # runs on PRs | ||
kyma-project/kyma: | ||
- name: pre-master-kyma-components-asset-metadata-service | ||
branches: | ||
- master | ||
<<: *job_template | ||
run_if_changed: "^components/asset-metadata-service/" | ||
optional: true | ||
extra_refs: | ||
- <<: *test_infra_ref | ||
base_ref: master | ||
labels: | ||
<<: *job_labels_template | ||
preset-build-pr: "true" | ||
|
||
postsubmits: | ||
kyma-project/kyma: | ||
- name: post-master-kyma-components-asset-metadata-service | ||
branches: | ||
- master | ||
<<: *job_template | ||
run_if_changed: "^components/asset-metadata-service/" | ||
extra_refs: | ||
- <<: *test_infra_ref | ||
base_ref: master | ||
labels: | ||
<<: *job_labels_template | ||
preset-build-master: "true" |