-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Create separate Jenkinsfile for Read-Replica feature #8676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kgeisz
wants to merge
4
commits into
apache:HBASE-30087
Choose a base branch
from
kgeisz:HBASE-30087-read-replica-jenkinsfile-test
base: HBASE-30087
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
706a734
Move dev-support/hbase_nightly_read_replica_test.sh -> dev-support/re…
kgeisz ec78269
Remove read-replica stage from dev-support/Jenkinsfile; Create new de…
kgeisz 65103b5
Update dev-support/README.md and dev-support/read-replica/README.md
kgeisz 48770bd
Change HBASE_HOST from localhost to host.docker.internal in dev-suppo…
kgeisz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,144 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
| pipeline { | ||
| agent any | ||
|
|
||
| options { | ||
| buildDiscarder(logRotator(numToKeepStr: '10')) | ||
| timeout (time: 2, unit: 'HOURS') | ||
| timestamps() | ||
| skipDefaultCheckout() | ||
| disableConcurrentBuilds() | ||
| } | ||
| environment { | ||
| OUTPUT_DIR_RELATIVE_READ_REPLICA = 'output-read-replica' | ||
| } | ||
| stages { | ||
|
|
||
| stage ('scm-checkout') { | ||
| steps { | ||
| dir('component') { | ||
| checkout scm | ||
| } | ||
| } | ||
| } | ||
| stage ('init health results') { | ||
| steps { | ||
| stash name: 'read-replica-result', allowEmpty: true, includes: "${OUTPUT_DIR_RELATIVE_READ_REPLICA}/doesn't-match" | ||
| } | ||
| } | ||
| stage ('hbase read-replica feature checks') { | ||
|
|
||
| environment { | ||
| BASEDIR = "${env.WORKSPACE}/component" | ||
| OUTPUT_DIR_RELATIVE = "${env.OUTPUT_DIR_RELATIVE_READ_REPLICA}" | ||
| OUTPUT_DIR = "${env.WORKSPACE}/${env.OUTPUT_DIR_RELATIVE_READ_REPLICA}" | ||
| } | ||
| steps { | ||
| sh '''#!/usr/bin/env bash | ||
| set -e | ||
| rm -rf "${OUTPUT_DIR}" && mkdir -p "${OUTPUT_DIR}" | ||
| echo '(x) {color:red}-1 read-replica checks{color}' >"${OUTPUT_DIR}/commentfile" | ||
| echo "-- Something went wrong running this stage, please [check relevant console output|${BUILD_URL}/console]." >> "${OUTPUT_DIR}/commentfile" | ||
| ''' | ||
| dir('component') { | ||
| checkout scm | ||
| } | ||
| sh '''#!/usr/bin/env bash | ||
| set -e | ||
| rm -rf "${OUTPUT_DIR}/machine" && mkdir -p "${OUTPUT_DIR}/machine" | ||
| "${BASEDIR}/dev-support/gather_machine_environment.sh" "${OUTPUT_DIR_RELATIVE}/machine" | ||
| echo "got the following saved stats in '${OUTPUT_DIR_RELATIVE}/machine'" | ||
| ls -lh "${OUTPUT_DIR_RELATIVE}/machine" | ||
| ''' | ||
| script { | ||
| def ret = sh( | ||
| returnStatus: true, | ||
| script: '''#!/usr/bin/env bash | ||
| set -e | ||
| declare -i status=0 | ||
| if "${BASEDIR}/dev-support/read-replica/hbase_nightly_read_replica_test.sh" ; then | ||
| echo '(/) {color:green}+1 read-replica checks{color}' > "${OUTPUT_DIR}/commentfile" | ||
| else | ||
| echo '(x) {color:red}-1 read-replica checks{color}' > "${OUTPUT_DIR}/commentfile" | ||
| status=1 | ||
| fi | ||
| echo "-- For more information [see read-replica test report|${BUILD_URL}Read_20Replica_20Nightly_20Test_20Report/]" >> "${OUTPUT_DIR}/commentfile" | ||
| exit "${status}" | ||
| ''' | ||
| ) | ||
| if (ret != 0) { | ||
| // mark the build as UNSTABLE instead of FAILURE to allow post processing of test reports (HBASE-26339) | ||
| currentBuild.result = 'UNSTABLE' | ||
| } | ||
| } | ||
| } | ||
| post { | ||
| always { | ||
| // 1. Publish JUnit XML metrics for Jenkins trend charts | ||
| junit testResults: "${env.OUTPUT_DIR_RELATIVE}/read-replica-nightly-test-results.xml", allowEmptyResults: true | ||
|
|
||
| // 2. Render interactive HTML test report in the Jenkins UI navigation bar | ||
| publishHTML target: [ | ||
| allowMissing : true, | ||
| keepAll : true, | ||
| alwaysLinkToLastBuild: true, | ||
| reportDir : "${env.OUTPUT_DIR_RELATIVE}", | ||
| reportFiles : 'read-replica-nightly-test-report.html', | ||
| reportName : 'Read Replica Nightly Test Report' | ||
| ] | ||
|
|
||
| stash name: 'read-replica-result', includes: "${OUTPUT_DIR_RELATIVE}/commentfile" | ||
| archiveArtifacts artifacts: "${env.OUTPUT_DIR_RELATIVE}/**/*", allowEmptyArchive: true | ||
| } | ||
| } | ||
| } | ||
| } | ||
| post { | ||
| always { | ||
| script { | ||
| try { | ||
| sh "printenv" | ||
| sh ''' | ||
| echo "Clean up result directories" | ||
| rm -rf ${OUTPUT_DIR_RELATIVE_READ_REPLICA} | ||
| ''' | ||
| unstash 'read-replica-result' | ||
|
|
||
| def results = ["${env.OUTPUT_DIR_RELATIVE_READ_REPLICA}/commentfile"] | ||
| echo env.BRANCH_NAME | ||
| echo env.BUILD_URL | ||
| echo currentBuild.result | ||
| echo currentBuild.durationString | ||
| def comment = "Results for branch ${env.BRANCH_NAME}\n" | ||
| comment += "\t[build ${currentBuild.displayName} on builds.a.o|${env.BUILD_URL}]: " | ||
| if (currentBuild.result == null || currentBuild.result == "SUCCESS") { | ||
| comment += "(/) *{color:green}+1 overall{color}*\n" | ||
| } else { | ||
| comment += "(x) *{color:red}-1 overall{color}*\n" | ||
| } | ||
| comment += "----\ndetails (if available):\n\n" | ||
| echo "" | ||
| echo "[DEBUG] trying to aggregate step-wise results" | ||
| comment += results.collect { fileExists(file: it) ? readFile(file: it) : "" }.join("\n\n") | ||
| echo "[INFO] Final aggregated comment (would be posted to JIRA in production):" | ||
| echo comment | ||
| } catch (Exception exception) { | ||
| echo "Got exception: ${exception}" | ||
| echo " ${exception.getStackTrace()}" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@taklwu this needs to be set to
host.docker.internalin order to get it running in my local Jenkins setup. We will see how this goes with the upstream Jenkins.HBASE_HOSTis used for curling the HBase UI to see if it's up. It's part of the process of verifying HBase has started. (here it is in the code)The only problem with this is if I want to run the tests locally with
hbase_nightly_read_replica_test.sh(without Jenkins) thenHBASE_HOSTshould belocalhost. We may want to think of a way to make it easier for a user to run this without having to know they should modifyHBASE_HOSTto make itlocalhost.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use something like
hostname -athen it could auto detect the hostname ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like you can use it in
build-images.shline #21 and overwrite the hostname? or is it how the.envis being used?