generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 312
Support 1password in all opensearch-build jenkins workflows #5642
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
Merged
peterzhuamazon
merged 14 commits into
opensearch-project:main
from
peterzhuamazon:op-docker-manifest-gradle-vul-updates
Jul 23, 2025
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3645968
Support 1password in docker build workflow
peterzhuamazon 0545fd1
Add tests dockerbuild
peterzhuamazon 9700d1c
Add Vulnerability scan
peterzhuamazon f808fd3
Add more tests and jenkinsfile onboarding
peterzhuamazon 44c2f5f
Merge branch 'main' of github.com:peterzhuamazon/opensearch-build int…
peterzhuamazon 7834b0c
Add test release branch jenkins workflows
peterzhuamazon 44d7383
Add release notes check and compile jenkins workflow
peterzhuamazon f6215fe
Add release test manifest commit lock jenkins workflows
peterzhuamazon 02d83a0
Add release promotion
peterzhuamazon a5e1fff
Add release promotion jenkins related tests
peterzhuamazon 08e8c11
Add distribution builds
peterzhuamazon 7b42c96
Add benchmark test
peterzhuamazon 616e507
Add test benchmkark pull request jenkins workflows
peterzhuamazon 1a764f4
Add benchmark compare
peterzhuamazon 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,11 @@ | |
* compatible open source license. | ||
*/ | ||
|
||
def secret_dockerhub_readonly = [ | ||
[envVar: 'DOCKER_USERNAME', secretRef: 'op://opensearch-infra-secrets/dockerhub-production-readonly-credentials/username'], | ||
[envVar: 'DOCKER_PASSWORD', secretRef: 'op://opensearch-infra-secrets/dockerhub-production-readonly-credentials/password'] | ||
] | ||
|
||
lib = library(identifier: '[email protected]', retriever: modernSCM([ | ||
$class: 'GitSCMSource', | ||
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', | ||
|
@@ -102,10 +107,9 @@ pipeline { | |
|
||
def agent_name_array = params.AGENT_LABEL.tokenize('-') | ||
def agent_name = agent_name_array[2] + " " + agent_name_array[4] | ||
def CREDENTIAL_ID = 'jenkins-production-dockerhub-credential-readonly' | ||
|
||
echo("Build Cause: ${BUILD_CAUSE}") | ||
withCredentials([usernamePassword(credentialsId: CREDENTIAL_ID, usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD')]) { | ||
withSecrets(secrets: secret_dockerhub_readonly){ | ||
peterzhuamazon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
def bwc_checkout_align = "false" | ||
|
||
def dockerLogin = sh(returnStdout: true, script: "set +x && (echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin) || echo docker error").trim() | ||
|
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 |
---|---|---|
|
@@ -12,6 +12,11 @@ lib = library(identifier: '[email protected]', retriever: modernSCM([ | |
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', | ||
])) | ||
|
||
def secret_github_bot = [ | ||
[envVar: 'GITHUB_USER', secretRef: 'op://opensearch-infra-secrets/github-bot/ci-bot-username'], | ||
[envVar: 'GITHUB_TOKEN', secretRef: 'op://opensearch-infra-secrets/github-bot/ci-bot-token'] | ||
] | ||
|
||
pipeline { | ||
options { | ||
timeout(time: 4, unit: 'HOURS') | ||
|
@@ -1072,7 +1077,7 @@ def triggerDistributionValidationWorkflow(String version) { | |
} | ||
|
||
def triggerNightlyPlayground() { | ||
withCredentials([usernamePassword(credentialsId: 'jenkins-github-bot-token', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USER')]) { | ||
withSecrets(secrets: secret_github_bot){ | ||
println("Triggering nightly playground workflow.") | ||
try { | ||
sh( | ||
|
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 |
---|---|---|
|
@@ -8,11 +8,15 @@ | |
*/ | ||
|
||
lib = library(identifier: '[email protected]', retriever: modernSCM([ | ||
|
||
$class: 'GitSCMSource', | ||
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', | ||
])) | ||
|
||
def secret_github_bot = [ | ||
[envVar: 'GITHUB_USER', secretRef: 'op://opensearch-infra-secrets/github-bot/ci-bot-username'], | ||
[envVar: 'GITHUB_TOKEN', secretRef: 'op://opensearch-infra-secrets/github-bot/ci-bot-token'] | ||
] | ||
|
||
pipeline { | ||
agent { label 'Jenkins-Agent-AL2023-X64-M52xlarge-Benchmark-Test' } | ||
options { | ||
|
@@ -85,7 +89,7 @@ pipeline { | |
""" | ||
script { | ||
if ("${PULL_REQUEST_NUMBER}" != '' && "${REPOSITORY}" != '') { | ||
withCredentials([usernamePassword(credentialsId: 'jenkins-github-bot-token', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USER')]) { | ||
withSecrets(secrets: secret_github_bot){ | ||
def pull_request = Integer.parseInt("${PULL_REQUEST_NUMBER}") | ||
sh ("gh pr comment ${pull_request} --repo ${REPOSITORY} --body-file final_result_${BUILD_NUMBER}.md") | ||
} | ||
|
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 |
---|---|---|
|
@@ -8,11 +8,19 @@ | |
*/ | ||
|
||
lib = library(identifier: '[email protected]', retriever: modernSCM([ | ||
|
||
$class: 'GitSCMSource', | ||
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', | ||
])) | ||
|
||
def secret_github_bot = [ | ||
[envVar: 'GITHUB_USER', secretRef: 'op://opensearch-infra-secrets/github-bot/ci-bot-username'], | ||
[envVar: 'GITHUB_TOKEN', secretRef: 'op://opensearch-infra-secrets/github-bot/ci-bot-token'] | ||
] | ||
|
||
def secret_aws_account = [ | ||
[envVar: 'PERF_TEST_ACCOUNT_ID', secretRef: 'op://opensearch-infra-secrets/aws-accounts/perf-test-account-id'] | ||
] | ||
|
||
pipeline { | ||
agent {label 'Jenkins-Agent-AL2023-X64-M52xlarge-Benchmark-Test'} | ||
options { | ||
|
@@ -274,7 +282,7 @@ pipeline { | |
script { | ||
if (currentBuild.rawBuild.getCauses().toString().contains("GenericCause")) { | ||
if ("${pull_request_number}" != '' && "${repository}" != '') { | ||
withCredentials([usernamePassword(credentialsId: 'jenkins-github-bot-token', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USER')]) { | ||
withSecrets(secrets: secret_github_bot){ | ||
def pull_request = Integer.parseInt("${pull_request_number}") | ||
sh ("gh pr comment ${pull_request} --repo ${repository} --body-file final_result_${BUILD_NUMBER}.md") | ||
} | ||
|
@@ -306,7 +314,7 @@ pipeline { | |
script { | ||
if (currentBuild.rawBuild.getCauses().toString().contains("GenericCause")) { | ||
if ("${pull_request_number}" != '' && "${repository}" != '') { | ||
withCredentials([usernamePassword(credentialsId: 'jenkins-github-bot-token', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USER')]) { | ||
withSecrets(secrets: secret_github_bot){ | ||
def pull_request = Integer.parseInt("${pull_request_number}") | ||
sh ("gh pr comment ${pull_request} --repo ${repository} --body \"The benchmark job ${BUILD_URL} failed.\n Please see logs to debug.\"") | ||
} | ||
|
@@ -321,7 +329,7 @@ pipeline { | |
def stackNames = [ | ||
"opensearch-infra-stack-${BUILD_NUMBER}" | ||
] | ||
withCredentials([string(credentialsId: 'perf-test-account-id', variable: 'PERF_TEST_ACCOUNT_ID')]) { | ||
withSecrets(secrets: secret_aws_account){ | ||
withAWS(role: 'cfn-set-up', roleAccount: "${PERF_TEST_ACCOUNT_ID}", duration: 900, roleSessionName: 'jenkins-session', region: 'us-east-1') { | ||
try { | ||
for (String stackName : stackNames) { | ||
|
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 |
---|---|---|
|
@@ -13,6 +13,10 @@ lib = library(identifier: '[email protected]', retriever: modernSCM([ | |
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', | ||
])) | ||
|
||
def secret_aws_account = [ | ||
[envVar: 'PERF_TEST_ACCOUNT_ID', secretRef: 'op://opensearch-infra-secrets/aws-accounts/perf-test-account-id'] | ||
] | ||
|
||
pipeline { | ||
agent none | ||
options { | ||
|
@@ -437,7 +441,7 @@ pipeline { | |
"opensearch-infra-stack-${BUILD_NUMBER}" | ||
] | ||
} | ||
withCredentials([string(credentialsId: 'perf-test-account-id', variable: 'PERF_TEST_ACCOUNT_ID')]) { | ||
withSecrets(secrets: secret_aws_account){ | ||
withAWS(role: 'cfn-set-up', roleAccount: "${PERF_TEST_ACCOUNT_ID}", duration: 900, roleSessionName: 'jenkins-session', region: 'us-east-1') { | ||
try { | ||
for (String stackName : stackNames) { | ||
|
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 |
---|---|---|
|
@@ -13,6 +13,10 @@ lib = library(identifier: '[email protected]', retriever: modernSCM([ | |
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', | ||
])) | ||
|
||
def secret_aws_account = [ | ||
[envVar: 'PERF_TEST_ACCOUNT_ID', secretRef: 'op://opensearch-infra-secrets/aws-accounts/perf-test-account-id'] | ||
] | ||
|
||
pipeline { | ||
agent none | ||
options { | ||
|
@@ -486,7 +490,7 @@ pipeline { | |
"opensearch-infra-stack-${BUILD_NUMBER}" | ||
] | ||
} | ||
withCredentials([string(credentialsId: 'perf-test-account-id', variable: 'PERF_TEST_ACCOUNT_ID')]) { | ||
withSecrets(secrets: secret_aws_account){ | ||
withAWS(role: 'cfn-set-up', roleAccount: "${PERF_TEST_ACCOUNT_ID}", duration: 900, roleSessionName: 'jenkins-session', region: 'us-east-1') { | ||
try { | ||
for (String stackName : stackNames) { | ||
|
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 |
---|---|---|
|
@@ -12,6 +12,11 @@ lib = library(identifier: '[email protected]', retriever: modernSCM([ | |
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', | ||
])) | ||
|
||
def secret_github_bot = [ | ||
[envVar: 'GITHUB_USER', secretRef: 'op://opensearch-infra-secrets/github-bot/ci-bot-username'], | ||
[envVar: 'GITHUB_TOKEN', secretRef: 'op://opensearch-infra-secrets/github-bot/ci-bot-token'] | ||
] | ||
|
||
pipeline { | ||
options { | ||
timeout(time: 4, unit: 'HOURS') | ||
|
@@ -1097,7 +1102,7 @@ def triggerDistributionValidationWorkflow(String version) { | |
} | ||
|
||
def triggerNightlyPlayground() { | ||
withCredentials([usernamePassword(credentialsId: 'jenkins-github-bot-token', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USER')]) { | ||
withSecrets(secrets: secret_github_bot){ | ||
println("Triggering nightly playground workflow.") | ||
try { | ||
sh( | ||
|
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 |
---|---|---|
|
@@ -12,6 +12,11 @@ lib = library(identifier: '[email protected]', retriever: modernSCM([ | |
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', | ||
])) | ||
|
||
def secret_github_bot = [ | ||
[envVar: 'GITHUB_USER', secretRef: 'op://opensearch-infra-secrets/github-bot/ci-bot-username'], | ||
[envVar: 'GITHUB_TOKEN', secretRef: 'op://opensearch-infra-secrets/github-bot/ci-bot-token'] | ||
] | ||
|
||
pipeline { | ||
options { | ||
timeout(time: 1, unit: 'HOURS') | ||
|
@@ -56,7 +61,7 @@ pipeline { | |
|
||
def manifestList = MANIFEST_FILE.trim().split(' ') as List | ||
|
||
withCredentials([usernamePassword(credentialsId: "jenkins-github-bot-token", usernameVariable: 'GITHUB_USER', passwordVariable: 'GITHUB_TOKEN')]) { | ||
withSecrets(secrets: secret_github_bot){ | ||
for (manifest in manifestList) { | ||
if (manifest.contains("builds")) { | ||
|
||
|
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 |
---|---|---|
|
@@ -12,6 +12,11 @@ lib = library(identifier: '[email protected]', retriever: modernSCM([ | |
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', | ||
])) | ||
|
||
def secret_github_bot = [ | ||
[envVar: 'GITHUB_USER', secretRef: 'op://opensearch-infra-secrets/github-bot/ci-bot-username'], | ||
[envVar: 'GITHUB_TOKEN', secretRef: 'op://opensearch-infra-secrets/github-bot/ci-bot-token'] | ||
] | ||
|
||
pipeline { | ||
options { | ||
timeout(time: 2, unit: 'HOURS') | ||
|
@@ -212,7 +217,7 @@ pipeline { | |
stage('Create Pull Request') { | ||
steps { | ||
script { | ||
withCredentials([usernamePassword(credentialsId: 'jenkins-github-bot-token', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USER')]) { | ||
withSecrets(secrets: secret_github_bot){ | ||
try { | ||
sh """ | ||
git remote set-url origin "https://opensearch-ci:${GITHUB_TOKEN}@github.com/opensearch-project/opensearch-build" | ||
|
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 |
---|---|---|
|
@@ -12,6 +12,11 @@ lib = library(identifier: '[email protected]', retriever: modernSCM([ | |
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', | ||
])) | ||
|
||
def secret_github_bot = [ | ||
[envVar: 'GITHUB_USER', secretRef: 'op://opensearch-infra-secrets/github-bot/ci-bot-username'], | ||
[envVar: 'GITHUB_TOKEN', secretRef: 'op://opensearch-infra-secrets/github-bot/ci-bot-token'] | ||
] | ||
|
||
pipeline { | ||
options { | ||
timeout(time: 2, unit: 'HOURS') | ||
|
@@ -81,7 +86,7 @@ pipeline { | |
} | ||
steps { | ||
script { | ||
withCredentials([usernamePassword(credentialsId: "jenkins-github-bot-token", usernameVariable: 'GITHUB_USER', passwordVariable: 'GITHUB_TOKEN')]) { | ||
withSecrets(secrets: secret_github_bot){ | ||
if (params.COMMENT == "ADD") { | ||
sh """ | ||
#!/bin/bash | ||
|
@@ -128,7 +133,7 @@ pipeline { | |
set +e | ||
./release_notes.sh compile manifests/${RELEASE_VERSION}/opensearch-${RELEASE_VERSION}.yml manifests/${RELEASE_VERSION}/opensearch-dashboards-${RELEASE_VERSION}.yml --output release-notes/opensearch-release-notes-${RELEASE_VERSION}.md | ||
""" | ||
withCredentials([usernamePassword(credentialsId: 'jenkins-github-bot-token', passwordVariable: 'GITHUB_TOKEN', usernameVariable: 'GITHUB_USER')]) { | ||
withSecrets(secrets: secret_github_bot){ | ||
try { | ||
sh """ | ||
git remote set-url origin "https://opensearch-ci:${GITHUB_TOKEN}@github.com/opensearch-project/opensearch-build" | ||
|
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 |
---|---|---|
|
@@ -12,6 +12,12 @@ lib = library(identifier: '[email protected]', retriever: modernSCM([ | |
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', | ||
])) | ||
|
||
def secret_aws = [ | ||
[envVar: 'ARTIFACT_PROMOTION_ROLE_NAME', secretRef: 'op://opensearch-infra-secrets/aws-iam-roles/jenkins-artifact-promotion-role'], | ||
[envVar: 'AWS_ACCOUNT_ARTIFACT', secretRef: 'op://opensearch-infra-secrets/aws-accounts/jenkins-aws-production-account'], | ||
[envVar: 'CLOUDFRONT_DISTRIBUTION_ID', secretRef: 'op://opensearch-infra-secrets/aws-resource-arns/cloudfront-distribution-id'] | ||
] | ||
|
||
pipeline { | ||
options { | ||
timeout(time: 4, unit: 'HOURS') | ||
|
@@ -443,10 +449,7 @@ pipeline { | |
script { | ||
echo 'Invalidating cloudfront' | ||
def majorVersion=params.RELEASE_VERSION.find(/\d/) | ||
withCredentials([ | ||
string(credentialsId: 'jenkins-artifact-promotion-role', variable: 'ARTIFACT_PROMOTION_ROLE_NAME'), | ||
string(credentialsId: 'jenkins-aws-production-account', variable: 'AWS_ACCOUNT_ARTIFACT'), | ||
string(credentialsId: 'cloudfront-distribution-id', variable: 'CLOUDFRONT_DISTRIBUTION_ID')]) { | ||
withSecrets(secrets: secret_aws){ | ||
withAWS(role: "${ARTIFACT_PROMOTION_ROLE_NAME}", roleAccount: "${AWS_ACCOUNT_ARTIFACT}", duration: 900, roleSessionName: 'jenkins-session') { | ||
cfInvalidate(distribution: "${CLOUDFRONT_DISTRIBUTION_ID}", paths: ["/releases/bundle/opensearch/${majorVersion}.x/*", "/releases/bundle/opensearch-dashboards/${majorVersion}.x/*"], waitForCompletion: true) | ||
} | ||
|
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
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.