Skip to content

Commit

Permalink
golden test
Browse files Browse the repository at this point in the history
  • Loading branch information
bandyopa committed Sep 3, 2024
1 parent 9649326 commit 440dbc5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
30 changes: 18 additions & 12 deletions tests/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ properties([
parameters([
string(
name: 'Quickstarter',
defaultValue: 'docker-plain',
description: 'Enter the quickstarter name which is to be tested. Use 'all' to test all the quickstarters together'
description: 'Enter the quickstarter name which is to be tested. Use "all" to test all the quickstarters together'
),
string(
name: 'QuickstarterRepository',
Expand All @@ -12,21 +11,30 @@ properties([
),
string(
name: 'quickstarterRef',
defaultValue: 'master',
defaultValue: '4.x',
description: 'Enter the reference for the quickstarter (e.g., branch, tag, or commit)'
),
string(
name: 'Project',
description: 'Enter the project name (in lower case) where the quickstarter will be provisioned'
),
string(
name: 'ODS_NAMESPACE',
defaultValue: 'ods',
description: 'Enter the project name where the quickstarter in lower case will be provisioned'
description: 'Enter the ods namespae to fetch the jenkins agent. Include "-cd" if the ODS Namespace is not ods as default'
),
string(
name: 'ODS_URL',
defaultValue: 'https://github.com/opendevstack',
description: 'Enter the whole URL of the ODS files (https included)'
),
string(
name: 'JENKINS_AGENT_TAG',
defaultValue: 'latest',
defaultValue: '4.x',
description: 'Enter the tag for the jenkins golang agent'
),
string(
name: 'SONAR_QUALITY_PROFILE',
description: 'Enter the tag for the jenkins golang agent'
),
text(
Expand All @@ -50,9 +58,7 @@ def project = params.Project
// The Quickstarter to test
def quickstarter = params.Quickstarter
// Namespace fo the cd project
def odsNamespace = env.ODS_NAMESPACE ?: "$project-cd"
// projectID
def projectId = env.PROJECT_ID
def odsNamespace = params.ODS_NAMESPACE
// odsReference
def odsRef = params.quickstarterRef?:"master"
// QS repo
Expand All @@ -69,6 +75,7 @@ def ODS_CORE_URL = "${ODS_URL}/ods-core.git"
def ODS_CORE_BRANCH = "${quickstarterRef}"

def JENKINS_AGENT_TAG = "${JENKINS_AGENT_TAG}"
def SONAR_QUALITY_PROFILE = "${SONAR_QUALITY_PROFILE}"

// List of QS that we want to exclude from the execution of the job.
def excludedQS = params.excludedQuickstarters?:''
Expand All @@ -87,7 +94,7 @@ node {

def conts = containerTemplate(
name: 'jnlp',
image: "${dockerRegistry}/${odsNamespace}/jenkins-agent-golang:"${JENKINS_AGENT_TAG}"",
image: "${dockerRegistry}/${odsNamespace}/jenkins-agent-golang:${JENKINS_AGENT_TAG}",
workingDir: '/tmp',
alwaysPullImage: true,
args: ''
Expand All @@ -112,8 +119,7 @@ podTemplate(
url: "${QUICK_STARTERS_URL}"
}
dir('ods-configuration'){
//git branch: "${ODS_CONFIGURATION_BRANCH}",
git branch: "EDPQSTEST", // hardcoded for testing, remove before merging to github
git branch: "${ODS_CONFIGURATION_BRANCH}",
credentialsId: "${project}-cd-cd-user-token",
url: "${ODS_CONFIGURATION_URL}"
}
Expand Down Expand Up @@ -146,7 +152,7 @@ podTemplate(
withEnv([
"CGO_ENABLED=0",
"GOMODCACHE=${WORKSPACE}/.cache",
"SONAR_QUALITY_PROFILE=sonar way",
"SONAR_QUALITY_PROFILE=${SONAR_QUALITY_PROFILE}",
"ODS_GIT_REF=${odsRef}"]) {
sh """
cd ods-core/tests
Expand Down
3 changes: 0 additions & 3 deletions tests/quickstarter/quickstarter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ func TestQuickstarter(t *testing.T) {

func executeProvision(t *testing.T, step TestStep, testdataPath string, tmplData TemplateData, repoName string, quickstarterRepo string, quickstarterName string, config map[string]string) {
// cleanup and create bb resources for this test
fmt.Printf("\n\n\nConfig:\n%s\n\n", config)
fmt.Printf("\n\n\nUtils.ProjectName:\n%s\n\n", utils.PROJECT_NAME)
fmt.Printf("\n\n\repoName:\n%s\n\n", repoName)
err := recreateBitbucketRepo(config, utils.PROJECT_NAME, repoName)
if err != nil {
t.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/recreate-bitbucket-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ if [ "${httpCode}" == "404" ]; then
elif [ "${httpCode}" == "200" ]; then
echo_info "Found project ${BITBUCKET_PROJECT} in Bitbucket."
else
echo_error "Could not determine state of project ${BITBUCKET_PROJECT} on Bitbucket with url ${BITBUCKET_URL}, got ${httpCode}."
echo_error "Could not determine state of project ${BITBUCKET_PROJECT} on Bitbucket, got ${httpCode}."
exit 1
fi

Expand Down

0 comments on commit 440dbc5

Please sign in to comment.