Skip to content

Commit 4df343a

Browse files
authored
SRE-3104 ci: Use DAOS specific HTTPS_PROXY variable (#470)
SRE-3104 ci: Use DAOS_HTTPS_PROXY environment variable instead of HTTPS_PROXY The HTTPS_PROXY variable set in Jenkins may force any shell script to use a proxy server. This is not expected, as we want to avoid using a proxy unless it is explicitly needed by the DAOS tests or the build process. In details: * Pass HTTPS_PROXY explicitly to the build script. * Pass HTTPS_PROXY to post_provision_config.sh * Pass HTTPS_PROXY to Docekr build command * pip3 install requires proxy to access internet * pip3 install requires explicitly pass proxy parameter with `--proxy` Signed-off-by: Tomasz Gromadzki <tomasz.gromadzki@hpe.com>
1 parent cc19422 commit 4df343a

9 files changed

+79
-11
lines changed

Jenkinsfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env groovy
22
/* groovylint-disable DuplicateListLiteral, DuplicateMapLiteral, DuplicateNumberLiteral */
33
// groovylint-disable DuplicateStringLiteral, NestedBlockDepth, VariableName
4-
/* Copyright (C) 2019-2023 Intel Corporation
4+
/* Copyright 2019-2024 Intel Corporation
5+
* Copyright 2025 Hewlett Packard Enterprise Development LP
56
* All rights reserved.
67
*
78
* This file is part of the DAOS Project. It is subject to the license terms
@@ -229,6 +230,7 @@ pipeline {
229230
dockerfile {
230231
filename 'docker/Dockerfile.el.8'
231232
label 'docker_runner'
233+
additionalBuildArgs dockerBuildArgs()
232234
}
233235
}
234236
steps {
@@ -268,7 +270,7 @@ pipeline {
268270
dockerfile {
269271
filename 'docker/Dockerfile.el.8'
270272
label 'docker_runner'
271-
additionalBuildArgs dockerBuildArgs(cachebust: false, add_repos: false)
273+
additionalBuildArgs dockerBuildArgs(cachebust: false)
272274
}
273275
}
274276
steps {

vars/buildRpm.groovy

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/* groovylint-disable DuplicateStringLiteral, VariableName */
22
// vars/buildRpm.groovy
3+
/*
4+
* Copyright 2020-2024 Intel Corporation
5+
* Copyright 2025 Hewlett Packard Enterprise Development LP
6+
*/
37

48
/**
59
* buildRpm step method
@@ -60,6 +64,16 @@ Map call(Map config = [:]) {
6064
env_vars = ' CHROOT_NAME=' + config['chroot_name']
6165
}
6266

67+
String https_proxy = ''
68+
if (env.DAOS_HTTPS_PROXY) {
69+
https_proxy = "${env.DAOS_HTTPS_PROXY}"
70+
} else if (env.HTTPS_PROXY) {
71+
https_proxy = "${env.HTTPS_PROXY}"
72+
}
73+
if (https_proxy) {
74+
env_vars += ' HTTPS_PROXY=' + https_proxy
75+
}
76+
6377
String error_stage_result = 'FAILURE'
6478
String error_build_result = 'FAILURE'
6579
if (config['unstable']) {

vars/dockerBuildArgs.groovy

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/* groovylint-disable DuplicateStringLiteral, VariableName */
22
// vars/dockerBuildArgs.groovy
3+
/*
4+
* Copyright 2020-2024 Intel Corporation
5+
* Copyright 2025 Hewlett Packard Enterprise Development LP
6+
*/
37

48
Integer num_proc() {
59
return sh(label: 'Get number of processors online',
@@ -31,7 +35,6 @@ Integer num_proc() {
3135

3236
String call(Map config = [:]) {
3337
Boolean cachebust = config.get('cachebust', true)
34-
Boolean add_repos = config.get('add_repos', true)
3538
Boolean deps_build = config.get('deps_build', false)
3639
Boolean parallel_build = config.get('parallel_build', false)
3740

@@ -55,12 +58,22 @@ String call(Map config = [:]) {
5558
}
5659

5760
// pass through env. var.s
58-
['DAOS_LAB_CA_FILE_URL', 'REPO_FILE_URL', 'HTTP_PROXY', 'HTTPS_PROXY'].each { var ->
61+
['DAOS_LAB_CA_FILE_URL', 'REPO_FILE_URL', 'HTTP_PROXY'].each { var ->
5962
if (env."$var") {
6063
ret_str += ' --build-arg ' + var + '="' + env."$var" + '"'
6164
}
6265
}
6366

67+
String https_proxy = ''
68+
if (env.DAOS_HTTPS_PROXY) {
69+
https_proxy = env.DAOS_HTTPS_PROXY
70+
} else if (env.HTTPS_PROXY) {
71+
https_proxy = env.HTTPS_PROXY
72+
}
73+
if (https_proxy) {
74+
ret_str += ' --build-arg HTTPS_PROXY' + '="' + https_proxy + '"'
75+
}
76+
6477
if (config['qb']) {
6578
ret_str += ' --build-arg QUICKBUILD=true --build-arg DAOS_DEPS_BUILD=no'
6679
} else {

vars/functionalTest.groovy

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/* groovylint-disable VariableName */
22
// vars/functionalTest.groovy
3+
/*
4+
* Copyright 2020-2024 Intel Corporation
5+
* Copyright 2025 Hewlett Packard Enterprise Development LP
6+
*/
37

48
/**
59
* functionalTest step method
@@ -110,8 +114,17 @@ Map call(Map config = [:]) {
110114
run_test_config['context'] = context
111115
run_test_config['description'] = description
112116

113-
sh label: 'Install Launchable',
114-
script: '''if ! pip3 install --upgrade --upgrade-strategy only-if-needed launchable; then
117+
String https_proxy = ''
118+
if (env.DAOS_HTTPS_PROXY) {
119+
https_proxy = "${env.DAOS_HTTPS_PROXY}"
120+
} else if (env.HTTPS_PROXY) {
121+
https_proxy = "${env.HTTPS_PROXY}"
122+
}
123+
String script = 'if ! pip3 install'
124+
if (https_proxy) {
125+
script += ' --proxy "' + https_proxy + '"'
126+
}
127+
script += ''' --upgrade --upgrade-strategy only-if-needed launchable; then
115128
set +e
116129
echo "Failed to install launchable"
117130
id
@@ -125,6 +138,8 @@ Map call(Map config = [:]) {
125138
fi
126139
pip3 list --user || true
127140
'''
141+
sh label: 'Install Launchable',
142+
script: script
128143

129144
try {
130145
withCredentials([string(credentialsId: 'launchable-test', variable: 'LAUNCHABLE_TOKEN')]) {

vars/functionalTestPostV2.groovy

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,21 @@ void call(Map config = [:]) {
9898
script: 'ci/functional/launchable_analysis "' + fileName + '"')
9999
}
100100

101+
String https_proxy = ''
102+
if (env.DAOS_HTTPS_PROXY) {
103+
https_proxy = "${env.DAOS_HTTPS_PROXY}"
104+
} else if (env.HTTPS_PROXY) {
105+
https_proxy = "${env.HTTPS_PROXY}"
106+
}
107+
String script = 'pip3 install'
108+
if (https_proxy) {
109+
script += ' --proxy "' + https_proxy + '"'
110+
}
111+
script += ' --user --upgrade launchable~=1.0'
112+
113+
101114
sh(label: 'Install Launchable',
102-
script: 'pip3 install --user --upgrade launchable~=1.0')
115+
script: script)
103116

104117
try {
105118
withCredentials([string(credentialsId: 'launchable-test', variable: 'LAUNCHABLE_TOKEN')]) {

vars/packageBuildingPipeline.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/groovy
22
/* groovylint-disable DuplicateMapLiteral, DuplicateStringLiteral, NestedBlockDepth */
3-
/* Copyright (C) 2019-2023 Intel Corporation
3+
/* Copyright 2019-2023 Intel Corporation
44
* All rights reserved.
55
*
66
* Redistribution and use in source and binary forms, with or without

vars/packageBuildingPipelineDAOS.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/groovy
22
/* groovylint-disable DuplicateMapLiteral, DuplicateStringLiteral, NestedBlockDepth, VariableName */
3-
/* Copyright (C) 2019-2023 Intel Corporation
3+
/* Copyright 2019-2023 Intel Corporation
44
* All rights reserved.
55
*
66
* Redistribution and use in source and binary forms, with or without

vars/packageBuildingPipelineDAOSTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/groovy
22
/* groovylint-disable DuplicateMapLiteral, DuplicateStringLiteral, NestedBlockDepth, VariableName */
3-
/* Copyright (C) 2019-2024 Intel Corporation
4-
* Copyright (C) 2025 Hewlett Packard Enterprise Development LP
3+
/* Copyright 2019-2024 Intel Corporation
4+
* Copyright 2025 Hewlett Packard Enterprise Development LP
55
* All rights reserved.
66
*
77
* Redistribution and use in source and binary forms, with or without

vars/provisionNodes.groovy

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/* groovylint-disable DuplicateNumberLiteral, DuplicateStringLiteral, VariableName */
22
// vars/provisionNodes.groovy
3+
/*
4+
* Copyright 2020-2024 Intel Corporation
5+
* Copyright 2025 Hewlett Packard Enterprise Development LP
6+
*/
37

48
/**
59
* provisionNodes.groovy
@@ -155,6 +159,12 @@ Map call(Map config = [:]) {
155159
default:
156160
error "Unsupported distro type: ${distro_type}/distro: ${distro}"
157161
}
162+
String https_proxy = ''
163+
if (env.DAOS_HTTPS_PROXY) {
164+
https_proxy = "${env.DAOS_HTTPS_PROXY}"
165+
} else if (env.HTTPS_PROXY) {
166+
https_proxy = "${env.HTTPS_PROXY}"
167+
}
158168
provision_script += ' ' +
159169
'NODESTRING=' + nodeString + ' ' +
160170
'CONFIG_POWER_ONLY=' + config_power_only + ' ' +
@@ -164,6 +174,7 @@ Map call(Map config = [:]) {
164174
// https://issues.jenkins.io/browse/JENKINS-55819
165175
'CI_RPM_TEST_VERSION="' + (params.CI_RPM_TEST_VERSION ?: '') + '" ' +
166176
'CI_PR_REPOS="' + (params.CI_PR_REPOS ?: '') + '" ' +
177+
'HTTPS_PROXY="' + https_proxy + '" ' +
167178
'ci/provisioning/post_provision_config.sh'
168179
new_config['post_restore'] = provision_script
169180
try {

0 commit comments

Comments
 (0)