diff options
author | 2016-07-07 13:43:15 +0200 | |
---|---|---|
committer | 2016-07-07 22:04:19 +0200 | |
commit | 43826ac925baab281a77e76f917bcadb978c9a52 (patch) | |
tree | cb67fb26beede406d23cf34669be93b45caa0f36 /jjb | |
parent | d893d399ca57337e2095338bd48cb891f0b21940 (diff) |
sandbox: Pass GERRIT parameters and create merge jobs
Change-Id: Idf4f87043929ab1c0e97a60899a116c745386a96
Signed-off-by: Fatih Degirmenci <fatih.degirmenci@ericsson.com>
Diffstat (limited to 'jjb')
-rwxr-xr-x | jjb/sandbox/basic.sh | 61 | ||||
-rwxr-xr-x | jjb/sandbox/build.sh | 61 | ||||
-rwxr-xr-x | jjb/sandbox/deploy.sh | 61 | ||||
-rwxr-xr-x | jjb/sandbox/merge.sh | 61 | ||||
-rwxr-xr-x | jjb/sandbox/promote.sh | 61 | ||||
-rw-r--r-- | jjb/sandbox/sandbox-merge-jobs.yml | 159 | ||||
-rw-r--r-- | jjb/sandbox/sandbox-verify-jobs.yml | 159 | ||||
-rwxr-xr-x | jjb/sandbox/test.sh | 61 | ||||
-rwxr-xr-x | jjb/sandbox/verify.sh | 29 |
9 files changed, 586 insertions, 127 deletions
diff --git a/jjb/sandbox/basic.sh b/jjb/sandbox/basic.sh new file mode 100755 index 000000000..2f9be2729 --- /dev/null +++ b/jjb/sandbox/basic.sh @@ -0,0 +1,61 @@ +#!/bin/bash +#set -o errexit +#set -o nounset +#set -o pipefail + +# get the job type +# we only support verify, merge, daily and weekly jobs +if [[ "$JOB_NAME" =~ (verify|merge|daily|weekly) ]]; then + JOB_TYPE=${BASH_REMATCH[0]} +else + echo "Unable to determine job type!" + exit 1 +fi + +# do stuff differently based on the job type +case "$JOB_TYPE" in + verify) + echo "Running as part of verify job" + ;; + merge) + echo "Running as part of merge job" + ;; + daily) + echo "Running as part of daily job" + ;; + weekly) + echo "Running as part of weekly job" + ;; + *) + echo "Job type $JOB_TYPE is not supported!" + exit 1 +esac + +# this just shows we can get the patch/commit information +# no matter what job we are executed by +cd $WORKSPACE +echo +echo "Commit Message is" +echo "-------------------------------------" +git log --format=%B -n 1 $(git rev-parse HEAD) +echo "-------------------------------------" +echo +echo "Repo contents" +echo "-------------------------------------" +ls -al +echo "-------------------------------------" +echo +echo "Changed files are" +echo "-------------------------------------" +git diff origin/master --name-only +echo "-------------------------------------" +echo +echo "Change introduced" +echo "-------------------------------------" +git diff origin/master +echo "-------------------------------------" +echo +echo "git show" +echo "-------------------------------------" +git show +echo "-------------------------------------" diff --git a/jjb/sandbox/build.sh b/jjb/sandbox/build.sh new file mode 100755 index 000000000..2f9be2729 --- /dev/null +++ b/jjb/sandbox/build.sh @@ -0,0 +1,61 @@ +#!/bin/bash +#set -o errexit +#set -o nounset +#set -o pipefail + +# get the job type +# we only support verify, merge, daily and weekly jobs +if [[ "$JOB_NAME" =~ (verify|merge|daily|weekly) ]]; then + JOB_TYPE=${BASH_REMATCH[0]} +else + echo "Unable to determine job type!" + exit 1 +fi + +# do stuff differently based on the job type +case "$JOB_TYPE" in + verify) + echo "Running as part of verify job" + ;; + merge) + echo "Running as part of merge job" + ;; + daily) + echo "Running as part of daily job" + ;; + weekly) + echo "Running as part of weekly job" + ;; + *) + echo "Job type $JOB_TYPE is not supported!" + exit 1 +esac + +# this just shows we can get the patch/commit information +# no matter what job we are executed by +cd $WORKSPACE +echo +echo "Commit Message is" +echo "-------------------------------------" +git log --format=%B -n 1 $(git rev-parse HEAD) +echo "-------------------------------------" +echo +echo "Repo contents" +echo "-------------------------------------" +ls -al +echo "-------------------------------------" +echo +echo "Changed files are" +echo "-------------------------------------" +git diff origin/master --name-only +echo "-------------------------------------" +echo +echo "Change introduced" +echo "-------------------------------------" +git diff origin/master +echo "-------------------------------------" +echo +echo "git show" +echo "-------------------------------------" +git show +echo "-------------------------------------" diff --git a/jjb/sandbox/deploy.sh b/jjb/sandbox/deploy.sh new file mode 100755 index 000000000..2f9be2729 --- /dev/null +++ b/jjb/sandbox/deploy.sh @@ -0,0 +1,61 @@ +#!/bin/bash +#set -o errexit +#set -o nounset +#set -o pipefail + +# get the job type +# we only support verify, merge, daily and weekly jobs +if [[ "$JOB_NAME" =~ (verify|merge|daily|weekly) ]]; then + JOB_TYPE=${BASH_REMATCH[0]} +else + echo "Unable to determine job type!" + exit 1 +fi + +# do stuff differently based on the job type +case "$JOB_TYPE" in + verify) + echo "Running as part of verify job" + ;; + merge) + echo "Running as part of merge job" + ;; + daily) + echo "Running as part of daily job" + ;; + weekly) + echo "Running as part of weekly job" + ;; + *) + echo "Job type $JOB_TYPE is not supported!" + exit 1 +esac + +# this just shows we can get the patch/commit information +# no matter what job we are executed by +cd $WORKSPACE +echo +echo "Commit Message is" +echo "-------------------------------------" +git log --format=%B -n 1 $(git rev-parse HEAD) +echo "-------------------------------------" +echo +echo "Repo contents" +echo "-------------------------------------" +ls -al +echo "-------------------------------------" +echo +echo "Changed files are" +echo "-------------------------------------" +git diff origin/master --name-only +echo "-------------------------------------" +echo +echo "Change introduced" +echo "-------------------------------------" +git diff origin/master +echo "-------------------------------------" +echo +echo "git show" +echo "-------------------------------------" +git show +echo "-------------------------------------" diff --git a/jjb/sandbox/merge.sh b/jjb/sandbox/merge.sh new file mode 100755 index 000000000..2f9be2729 --- /dev/null +++ b/jjb/sandbox/merge.sh @@ -0,0 +1,61 @@ +#!/bin/bash +#set -o errexit +#set -o nounset +#set -o pipefail + +# get the job type +# we only support verify, merge, daily and weekly jobs +if [[ "$JOB_NAME" =~ (verify|merge|daily|weekly) ]]; then + JOB_TYPE=${BASH_REMATCH[0]} +else + echo "Unable to determine job type!" + exit 1 +fi + +# do stuff differently based on the job type +case "$JOB_TYPE" in + verify) + echo "Running as part of verify job" + ;; + merge) + echo "Running as part of merge job" + ;; + daily) + echo "Running as part of daily job" + ;; + weekly) + echo "Running as part of weekly job" + ;; + *) + echo "Job type $JOB_TYPE is not supported!" + exit 1 +esac + +# this just shows we can get the patch/commit information +# no matter what job we are executed by +cd $WORKSPACE +echo +echo "Commit Message is" +echo "-------------------------------------" +git log --format=%B -n 1 $(git rev-parse HEAD) +echo "-------------------------------------" +echo +echo "Repo contents" +echo "-------------------------------------" +ls -al +echo "-------------------------------------" +echo +echo "Changed files are" +echo "-------------------------------------" +git diff origin/master --name-only +echo "-------------------------------------" +echo +echo "Change introduced" +echo "-------------------------------------" +git diff origin/master +echo "-------------------------------------" +echo +echo "git show" +echo "-------------------------------------" +git show +echo "-------------------------------------" diff --git a/jjb/sandbox/promote.sh b/jjb/sandbox/promote.sh new file mode 100755 index 000000000..2f9be2729 --- /dev/null +++ b/jjb/sandbox/promote.sh @@ -0,0 +1,61 @@ +#!/bin/bash +#set -o errexit +#set -o nounset +#set -o pipefail + +# get the job type +# we only support verify, merge, daily and weekly jobs +if [[ "$JOB_NAME" =~ (verify|merge|daily|weekly) ]]; then + JOB_TYPE=${BASH_REMATCH[0]} +else + echo "Unable to determine job type!" + exit 1 +fi + +# do stuff differently based on the job type +case "$JOB_TYPE" in + verify) + echo "Running as part of verify job" + ;; + merge) + echo "Running as part of merge job" + ;; + daily) + echo "Running as part of daily job" + ;; + weekly) + echo "Running as part of weekly job" + ;; + *) + echo "Job type $JOB_TYPE is not supported!" + exit 1 +esac + +# this just shows we can get the patch/commit information +# no matter what job we are executed by +cd $WORKSPACE +echo +echo "Commit Message is" +echo "-------------------------------------" +git log --format=%B -n 1 $(git rev-parse HEAD) +echo "-------------------------------------" +echo +echo "Repo contents" +echo "-------------------------------------" +ls -al +echo "-------------------------------------" +echo +echo "Changed files are" +echo "-------------------------------------" +git diff origin/master --name-only +echo "-------------------------------------" +echo +echo "Change introduced" +echo "-------------------------------------" +git diff origin/master +echo "-------------------------------------" +echo +echo "git show" +echo "-------------------------------------" +git show +echo "-------------------------------------" diff --git a/jjb/sandbox/sandbox-merge-jobs.yml b/jjb/sandbox/sandbox-merge-jobs.yml new file mode 100644 index 000000000..32f75e69e --- /dev/null +++ b/jjb/sandbox/sandbox-merge-jobs.yml @@ -0,0 +1,159 @@ +- project: + name: 'sandbox-merge-jobs' + + project: 'sandbox' + + installer: 'sandbox' + + stream: + - master: + branch: '{stream}' + gs-pathname: '' + +# what are the verification activities we do for this installer + activity: + - 'basic' + - 'build' + - 'promote' + + jobs: + - 'sandbox-merge-{stream}' + - 'sandbox-merge-{activity}-{stream}' + +- job-template: + name: 'sandbox-merge-{stream}' + + parameters: + - project-parameter: + project: '{project}' + - gerrit-parameter: + branch: '{branch}' + - 'opnfv-build-ubuntu-defaults' + + wrappers: + - ssh-agent-credentials: + users: + - '{ssh-credentials}' + - timeout: + timeout: 360 + fail: true + + triggers: + - gerrit: + trigger-on: + - change-merged-event + - comment-added-contains-event: + comment-contains-value: 'remerge' + projects: + - project-compare-type: 'ANT' + project-pattern: '{project}' + branches: + - branch-compare-type: 'ANT' + branch-pattern: '**/{branch}' + forbidden-file-paths: + - compare-type: ANT + pattern: 'docs/**' + readable-message: true + + builders: + - description-setter: + description: "Built on $NODE_NAME" + - '{project}-merge-builder' + - trigger-builds: + - project: 'sandbox-merge-basic-{stream}' + current-parameters: false + predefined-parameters: + GERRIT_BRANCH=$GERRIT_BRANCH + GERRIT_REFSPEC=$GERRIT_REFSPEC + GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER + block: true + - trigger-builds: + - project: 'sandbox-merge-build-{stream}' + current-parameters: false + predefined-parameters: + GERRIT_BRANCH=$GERRIT_BRANCH + GERRIT_REFSPEC=$GERRIT_REFSPEC + GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER + block: true + - trigger-builds: + - project: 'sandbox-merge-promote-{stream}' + current-parameters: false + predefined-parameters: + GERRIT_BRANCH=$GERRIT_BRANCH + GERRIT_REFSPEC=$GERRIT_REFSPEC + GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER + block: true + +- job-template: + name: 'sandbox-merge-{activity}-{stream}' + + scm: + - gerrit-trigger-scm: + credentials-id: '{ssh-credentials}' + refspec: '' + choosing-strategy: 'default' + + wrappers: + - ssh-agent-credentials: + users: + - '{ssh-credentials}' + - timeout: + timeout: 360 + fail: true + + parameters: + - project-parameter: + project: '{project}' + - gerrit-parameter: + branch: '{branch}' + - '{installer}-defaults' + - '{project}-merge-{activity}-parameter' + + builders: + - description-setter: + description: "Built on $NODE_NAME" + - '{project}-merge-{activity}-builder' + +##################################### +# parameter builders +##################################### +- parameter: + name: 'sandbox-merge-basic-parameter' + parameters: + - 'opnfv-build-ubuntu-defaults' + +- parameter: + name: 'sandbox-merge-build-parameter' + parameters: + - 'opnfv-build-ubuntu-defaults' + +- parameter: + name: 'sandbox-merge-promote-parameter' + parameters: + - 'opnfv-build-centos-defaults' +##################################### +# builder builders +##################################### +- builder: + name: 'sandbox-merge-builder' + builders: + - shell: + !include-raw: ./merge.sh + +- builder: + name: 'sandbox-merge-basic-builder' + builders: + - shell: + !include-raw: ./basic.sh + +- builder: + name: 'sandbox-merge-build-builder' + builders: + - shell: + !include-raw: ./build.sh + +- builder: + name: 'sandbox-merge-promote-builder' + builders: + - shell: + !include-raw: ./promote.sh diff --git a/jjb/sandbox/sandbox-verify-jobs.yml b/jjb/sandbox/sandbox-verify-jobs.yml index b1e8e93cd..0572440a7 100644 --- a/jjb/sandbox/sandbox-verify-jobs.yml +++ b/jjb/sandbox/sandbox-verify-jobs.yml @@ -64,19 +64,39 @@ builders: - description-setter: - description: "POD: $NODE_NAME" + description: "Built on $NODE_NAME" - '{project}-verify-builder' - trigger-builds: - project: 'sandbox-verify-basic-{stream}' + current-parameters: false + predefined-parameters: + GERRIT_BRANCH=$GERRIT_BRANCH + GERRIT_REFSPEC=$GERRIT_REFSPEC + GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER block: true - trigger-builds: - project: 'sandbox-verify-build-{stream}' + current-parameters: false + predefined-parameters: + GERRIT_BRANCH=$GERRIT_BRANCH + GERRIT_REFSPEC=$GERRIT_REFSPEC + GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER block: true - trigger-builds: - project: 'sandbox-verify-deploy-{stream}' + current-parameters: false + predefined-parameters: + GERRIT_BRANCH=$GERRIT_BRANCH + GERRIT_REFSPEC=$GERRIT_REFSPEC + GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER block: true - trigger-builds: - project: 'sandbox-verify-test-{stream}' + current-parameters: false + predefined-parameters: + GERRIT_BRANCH=$GERRIT_BRANCH + GERRIT_REFSPEC=$GERRIT_REFSPEC + GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER block: true - job-template: @@ -106,7 +126,7 @@ builders: - description-setter: - description: "POD: $NODE_NAME" + description: "Built on $NODE_NAME" - '{project}-verify-{activity}-builder' ##################################### @@ -137,144 +157,29 @@ - builder: name: 'sandbox-verify-builder' builders: - - shell: | - #!/bin/bash - - # this is the builder for the parent/upstream job which we do nothing - cd $WORKSPACE - echo - echo "Commit Message is" - echo "-------------------------------------" - echo $GERRIT_CHANGE_COMMIT_MESSAGE - echo "-------------------------------------" - echo - echo "Repo contents" - echo "-------------------------------------" - ls -al - echo "-------------------------------------" - echo - echo "Changed files are" - echo "-------------------------------------" - git diff origin/master --name-only - echo "-------------------------------------" - echo - echo "Change introduced" - echo "-------------------------------------" - git diff origin/master - echo "-------------------------------------" + - shell: + !include-raw: ./verify.sh - builder: name: 'sandbox-verify-basic-builder' builders: - - shell: | - #!/bin/bash - - # this is where we check the commit message, unit test, etc. - cd $WORKSPACE - echo - echo "Commit Message is" - echo "-------------------------------------" - echo $GERRIT_CHANGE_COMMIT_MESSAGE - echo "-------------------------------------" - echo - echo "Repo contents" - echo "-------------------------------------" - ls -al - echo "-------------------------------------" - echo - echo "Changed files are" - echo "-------------------------------------" - git diff origin/master --name-only - echo "-------------------------------------" - echo - echo "Change introduced" - echo "-------------------------------------" - git diff origin/master - echo "-------------------------------------" + - shell: + !include-raw: ./basic.sh - builder: name: 'sandbox-verify-build-builder' builders: - - shell: | - #!/bin/bash - - # this is where we do the build - cd $WORKSPACE - echo - echo "Commit Message is" - echo "-------------------------------------" - echo $GERRIT_CHANGE_COMMIT_MESSAGE - echo "-------------------------------------" - echo - echo "Repo contents" - echo "-------------------------------------" - ls -al - echo "-------------------------------------" - echo - echo "Changed files are" - echo "-------------------------------------" - git diff origin/master --name-only - echo "-------------------------------------" - echo - echo "Change introduced" - echo "-------------------------------------" - git diff origin/master - echo "-------------------------------------" + - shell: + !include-raw: ./build.sh - builder: name: 'sandbox-verify-deploy-builder' builders: - - shell: | - #!/bin/bash - - # this is where we start the virtual deployment - cd $WORKSPACE - echo - echo "Commit Message is" - echo "-------------------------------------" - echo $GERRIT_CHANGE_COMMIT_MESSAGE - echo "-------------------------------------" - echo - echo "Repo contents" - echo "-------------------------------------" - ls -al - echo "-------------------------------------" - echo - echo "Changed files are" - echo "-------------------------------------" - git diff origin/master --name-only - echo "-------------------------------------" - echo - echo "Change introduced" - echo "-------------------------------------" - git diff origin/master - echo "-------------------------------------" + - shell: + !include-raw: ./deploy.sh - builder: name: 'sandbox-verify-test-builder' builders: - - shell: | - #!/bin/bash - - # this is where we do functest smoketest - cd $WORKSPACE - echo - echo "Commit Message is" - echo "-------------------------------------" - echo $GERRIT_CHANGE_COMMIT_MESSAGE - echo "-------------------------------------" - echo - echo "Repo contents" - echo "-------------------------------------" - ls -al - echo "-------------------------------------" - echo - echo "Changed files are" - echo "-------------------------------------" - git diff origin/master --name-only - echo "-------------------------------------" - echo - echo "Change introduced" - echo "-------------------------------------" - git diff origin/master - echo "-------------------------------------" + - shell: + !include-raw: ./test.sh diff --git a/jjb/sandbox/test.sh b/jjb/sandbox/test.sh new file mode 100755 index 000000000..2f9be2729 --- /dev/null +++ b/jjb/sandbox/test.sh @@ -0,0 +1,61 @@ +#!/bin/bash +#set -o errexit +#set -o nounset +#set -o pipefail + +# get the job type +# we only support verify, merge, daily and weekly jobs +if [[ "$JOB_NAME" =~ (verify|merge|daily|weekly) ]]; then + JOB_TYPE=${BASH_REMATCH[0]} +else + echo "Unable to determine job type!" + exit 1 +fi + +# do stuff differently based on the job type +case "$JOB_TYPE" in + verify) + echo "Running as part of verify job" + ;; + merge) + echo "Running as part of merge job" + ;; + daily) + echo "Running as part of daily job" + ;; + weekly) + echo "Running as part of weekly job" + ;; + *) + echo "Job type $JOB_TYPE is not supported!" + exit 1 +esac + +# this just shows we can get the patch/commit information +# no matter what job we are executed by +cd $WORKSPACE +echo +echo "Commit Message is" +echo "-------------------------------------" +git log --format=%B -n 1 $(git rev-parse HEAD) +echo "-------------------------------------" +echo +echo "Repo contents" +echo "-------------------------------------" +ls -al +echo "-------------------------------------" +echo +echo "Changed files are" +echo "-------------------------------------" +git diff origin/master --name-only +echo "-------------------------------------" +echo +echo "Change introduced" +echo "-------------------------------------" +git diff origin/master +echo "-------------------------------------" +echo +echo "git show" +echo "-------------------------------------" +git show +echo "-------------------------------------" diff --git a/jjb/sandbox/verify.sh b/jjb/sandbox/verify.sh new file mode 100755 index 000000000..f62d2b977 --- /dev/null +++ b/jjb/sandbox/verify.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# this is where we check the commit message, unit test, etc. +cd $WORKSPACE +echo +echo "Commit Message is" +echo "-------------------------------------" +git log --format=%B -n 1 $(git rev-parse HEAD) +echo "-------------------------------------" +echo +echo "Repo contents" +echo "-------------------------------------" +ls -al +echo "-------------------------------------" +echo +echo "Changed files are" +echo "-------------------------------------" +git diff origin/master --name-only +echo "-------------------------------------" +echo +echo "Change introduced" +echo "-------------------------------------" +git diff origin/master +echo "-------------------------------------" +echo +echo "git show" +echo "-------------------------------------" +git show +echo "-------------------------------------" |