abstract ssh credentials
closes: GRADE-2037 test plan - specs pass - EDU Shared/canvas-image-wip new jenkins build passes Change-Id: Ifbba4ed6b38629639c24ab6e751b4f91b783ba5f Reviewed-on: https://gerrit.instructure.com/182630 Tested-by: Jenkins Reviewed-by: Rex Fleischer <rfleischer@instructure.com> QA-Review: Derek Bender <djbender@instructure.com> Product-Review: Derek Bender <djbender@instructure.com>
This commit is contained in:
parent
f78762a5b0
commit
0090ef55d3
|
@ -1,22 +1,41 @@
|
|||
#!/usr/bin/env groovy
|
||||
|
||||
def gems = [
|
||||
'analytics', 'banner_grade_export_plugin', 'canvas_geoip', 'canvas_salesforce_plugin', 'canvas_webhooks',
|
||||
'canvas_zendesk_plugin', 'canvasnet_registration', 'catalog_provisioner', 'custom_reports', 'demo_site',
|
||||
'ims_es_importer_plugin', 'instructure_misc_plugin', 'migration_tool', 'multiple_root_accounts',
|
||||
'phone_home_plugin', 'respondus_lockdown_browser', 'uuid_provisioner'
|
||||
'analytics',
|
||||
'banner_grade_export_plugin',
|
||||
'canvas_geoip',
|
||||
'canvas_salesforce_plugin',
|
||||
'canvas_webhooks',
|
||||
'canvas_zendesk_plugin',
|
||||
'canvasnet_registration',
|
||||
'catalog_provisioner',
|
||||
'custom_reports',
|
||||
'demo_site',
|
||||
'ims_es_importer_plugin',
|
||||
'instructure_misc_plugin',
|
||||
'migration_tool',
|
||||
'multiple_root_accounts',
|
||||
'phone_home_plugin',
|
||||
'respondus_lockdown_browser',
|
||||
'uuid_provisioner'
|
||||
]
|
||||
|
||||
def fetchFromGerrit = { String repo, String path, String customRepoDestination = null ->
|
||||
def withGerritCredentials = { Closure command ->
|
||||
withCredentials([sshUserPrivateKey(credentialsId: '44aa91d6-ab24-498a-b2b4-911bcb17cc35', keyFileVariable: 'SSH_KEY_PATH', usernameVariable: 'SSH_USERNAME')]) {
|
||||
sh """
|
||||
mkdir -p ${path}/${customRepoDestination ?: repo}
|
||||
GIT_SSH_COMMAND='ssh -i \"$SSH_KEY_PATH\" -l \"$SSH_USERNAME\"' \
|
||||
git archive --remote=ssh://$GERRIT_URL/${repo} master | tar -x -C ${path}/${customRepoDestination ?: repo}
|
||||
"""
|
||||
command('$SSH_KEY_PATH', '$SSH_USERNAME')
|
||||
}
|
||||
}
|
||||
|
||||
def fetchFromGerrit = { String repo, String path, String customRepoDestination = null ->
|
||||
withGerritCredentials({ String SSH_KEY_PATH, String SSH_USER_NAME ->
|
||||
sh """
|
||||
mkdir -p ${path}/${customRepoDestination ?: repo}
|
||||
GIT_SSH_COMMAND='ssh -i \"$SSH_KEY_PATH\" -l \"$SSH_USERNAME\"' \
|
||||
git archive --remote=ssh://$GERRIT_URL/${repo} master | tar -x -C ${path}/${customRepoDestination ?: repo}
|
||||
"""
|
||||
})
|
||||
}
|
||||
|
||||
def fetchGems = gems.collectEntries { String gem ->
|
||||
[ "${gem}" : { fetchFromGerrit(gem, 'gems/plugins') } ]
|
||||
}
|
||||
|
@ -37,6 +56,11 @@ pipeline {
|
|||
}
|
||||
|
||||
stages {
|
||||
stage('Debug') {
|
||||
steps {
|
||||
sh 'printenv'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Other Project Dependencies') {
|
||||
parallel {
|
||||
|
@ -48,13 +72,13 @@ pipeline {
|
|||
stage('Vendor QTI Migration Tool') {
|
||||
steps {
|
||||
script {
|
||||
withCredentials([sshUserPrivateKey(credentialsId: '44aa91d6-ab24-498a-b2b4-911bcb17cc35', keyFileVariable: 'SSH_KEY_PATH', usernameVariable: 'SSH_USERNAME')]) {
|
||||
sh """
|
||||
mkdir -p vendor/QTIMigrationTool
|
||||
GIT_SSH_COMMAND='ssh -i \"$SSH_KEY_PATH\" -l \"$SSH_USERNAME\"' \
|
||||
git archive --remote=ssh://$GERRIT_URL/qti_migration_tool master | tar -x -C vendor/QTIMigrationTool
|
||||
"""
|
||||
}
|
||||
withGerritCredentials({ String SSH_KEY_PATH, String SSH_USER_NAME ->
|
||||
sh """
|
||||
mkdir -p vendor/QTIMigrationTool
|
||||
GIT_SSH_COMMAND='ssh -i \"$SSH_KEY_PATH\" -l \"$SSH_USERNAME\"' \
|
||||
git archive --remote=ssh://$GERRIT_URL/qti_migration_tool master | tar -x -C vendor/QTIMigrationTool
|
||||
"""
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,12 +86,12 @@ pipeline {
|
|||
stage('Config Files') {
|
||||
steps {
|
||||
script {
|
||||
withCredentials([sshUserPrivateKey(credentialsId: '44aa91d6-ab24-498a-b2b4-911bcb17cc35', keyFileVariable: 'SSH_KEY_PATH', usernameVariable: 'SSH_USERNAME')]) {
|
||||
withGerritCredentials({ String SSH_KEY_PATH, String SSH_USER_NAME ->
|
||||
sh """
|
||||
GIT_SSH_COMMAND='ssh -i \"$SSH_KEY_PATH\" -l \"$SSH_USERNAME\"' \
|
||||
git archive --remote=ssh://$GERRIT_URL/gerrit_builder master canvas-lms/config | tar -x -C config
|
||||
"""
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue