Skip to content

Commit 2b1bf9e

Browse files
CI: fix Jenkins build failures on release/3.18 (Nexus → Artifactory, macOS login shell)
1 parent d02d36d commit 2b1bf9e

4 files changed

Lines changed: 87 additions & 49 deletions

File tree

Jenkinsfile

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
1+
@Library('pipeline-utils')
2+
import com.snowflake.DevEnvUtils
13
import groovy.json.JsonOutput
24

35

46
timestamps {
5-
node('parallelizable-c7') {
7+
node('parallelizable-snowos') {
68
stage('checkout') {
79
scmInfo = checkout scm
810
println("${scmInfo}")
911
env.GIT_BRANCH = scmInfo.GIT_BRANCH
1012
env.GIT_COMMIT = scmInfo.GIT_COMMIT
13+
env.GIT_URL = scmInfo.GIT_URL
14+
}
15+
16+
stage('Authenticate Artifactory') {
17+
script {
18+
new DevEnvUtils().withSfCli {
19+
sh "sf artifact oci auth"
20+
}
21+
}
1122
}
1223

1324
stage('Build') {
1425
withCredentials([
15-
usernamePassword(credentialsId: '063fc85b-62a6-4181-9d72-873b43488411', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY'),
16-
string(credentialsId: 'a791118f-a1ea-46cd-b876-56da1b9bc71c',variable: 'NEXUS_PASSWORD')
26+
usernamePassword(credentialsId: '063fc85b-62a6-4181-9d72-873b43488411', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY')
1727
]) {
1828
sh '''\
1929
|cd $WORKSPACE
@@ -28,42 +38,10 @@ timestamps {
2838
'''.stripMargin()
2939
}
3040
}
31-
params = [
32-
string(name: 'branch', value: 'main'),
33-
string(name: 'client_git_commit', value: scmInfo.GIT_COMMIT),
34-
string(name: 'client_git_branch', value: scmInfo.GIT_BRANCH),
35-
string(name: 'parent_job', value: env.JOB_NAME),
36-
string(name: 'parent_build_number', value: env.BUILD_NUMBER),
37-
string(name: 'USE_PASSWORD', value: 'true')
38-
]
3941
parallel(
40-
'Test': {
41-
stage('Test') {
42-
try {
43-
def commit_hash = "main" // default which we want to override
44-
def bptp_tag = "bptp-stable"
45-
def response = authenticatedGithubCall("https://api.github.com/repos/snowflakedb/snowflake/git/ref/tags/${bptp_tag}")
46-
commit_hash = response.object.sha
47-
// Append the bptp-stable commit sha to params
48-
params += [string(name: 'svn_revision', value: commit_hash)]
49-
} catch(Exception e) {
50-
println("Exception computing commit hash from: ${response}")
51-
}
52-
parallel (
53-
'Test Python 39': { build job: 'RT-PyConnector39-PC',parameters: params},
54-
'Test Python 310': { build job: 'RT-PyConnector310-PC',parameters: params},
55-
'Test Python 311': { build job: 'RT-PyConnector311-PC',parameters: params},
56-
'Test Python 312': { build job: 'RT-PyConnector312-PC',parameters: params},
57-
'Test Python 313': { build job: 'RT-PyConnector313-PC',parameters: params},
58-
'Test Python 39 OldDriver': { build job: 'RT-PyConnector39-OldDriver-PC',parameters: params},
59-
'Test Python 39 FIPS': { build job: 'RT-FIPS-PyConnector39',parameters: params},
60-
)
61-
}
62-
},
6342
'Test Authentication': {
6443
stage('Test Authentication') {
6544
withCredentials([
66-
string(credentialsId: 'a791118f-a1ea-46cd-b876-56da1b9bc71c', variable: 'NEXUS_PASSWORD'),
6745
string(credentialsId: 'sfctest0-parameters-secret', variable: 'PARAMETERS_SECRET')
6846
]) {
6947
sh '''\
@@ -76,22 +54,48 @@ timestamps {
7654
'Test WIF': {
7755
stage('Test WIF') {
7856
withCredentials([
79-
string(credentialsId: 'sfctest0-parameters-secret', variable: 'PARAMETERS_SECRET')
57+
string(credentialsId: 'sfctest0-parameters-secret', variable: 'PARAMETERS_SECRET'),
58+
usernamePassword(credentialsId: 'jenkins-snowflakedb-github-app',
59+
usernameVariable: 'GITHUB_USER',
60+
passwordVariable: 'GITHUB_TOKEN')
8061
]) {
8162
sh '''\
8263
|#!/bin/bash -e
8364
|$WORKSPACE/ci/test_wif.sh
8465
'''.stripMargin()
8566
}
8667
}
68+
},
69+
'Test Revocation Validation': {
70+
stage('Test Revocation Validation') {
71+
withCredentials([
72+
usernamePassword(credentialsId: 'jenkins-snowflakedb-github-app',
73+
usernameVariable: 'GITHUB_USER',
74+
passwordVariable: 'GITHUB_TOKEN')
75+
]) {
76+
try {
77+
sh '$WORKSPACE/ci/test_revocation.sh'
78+
} finally {
79+
archiveArtifacts artifacts: 'revocation-results.json,revocation-report.html', allowEmptyArchive: true
80+
publishHTML(target: [
81+
allowMissing: true,
82+
alwaysLinkToLastBuild: true,
83+
keepAll: true,
84+
reportDir: '.',
85+
reportFiles: 'revocation-report.html',
86+
reportName: 'Revocation Validation Report'
87+
])
88+
}
89+
}
90+
}
8791
}
8892
)
8993
}
9094
}
9195

9296

9397
pipeline {
94-
agent { label 'regular-memory-node' }
98+
agent { label 'regular-memory-node-snowos' }
9599
options { timestamps() }
96100
environment {
97101
COMMIT_SHA_LONG = sh(returnStdout: true, script: "echo \$(git rev-parse " + "HEAD)").trim()

ci/build_darwin.sh

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -e
1+
#!/bin/bash -e -l
22
#
33
# Build Snowflake Python Connector on Mac
44
# NOTES:
@@ -9,10 +9,19 @@ THIS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
99
CONNECTOR_DIR="$(dirname "${THIS_DIR}")"
1010
DIST_DIR="$CONNECTOR_DIR/dist"
1111

12+
# Print a timestamped info message
13+
log() {
14+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*"
15+
}
16+
17+
log "[Info] Starting build_darwin.sh"
18+
log "[Info] Host: $(uname -a)"
19+
log "[Info] Python versions to build: ${PYTHON_VERSIONS}"
20+
1221
cd $CONNECTOR_DIR
1322
# Clean up previously built DIST_DIR
1423
if [ -d "${DIST_DIR}" ]; then
15-
echo "[WARN] ${DIST_DIR} already existing, deleting it..."
24+
log "[WARN] ${DIST_DIR} already existing, deleting it..."
1625
rm -rf "${DIST_DIR}"
1726
fi
1827
mkdir -p ${DIST_DIR}
@@ -25,20 +34,43 @@ for PYTHON_VERSION in ${PYTHON_VERSIONS}; do
2534
PYTHON="python${PYTHON_VERSION}"
2635
VENV_DIR="${CONNECTOR_DIR}/venv-${PYTHON_VERSION}"
2736

37+
log "[Info] ===== Starting build for Python ${PYTHON_VERSION} ====="
38+
39+
# Select the matching pyenv-installed version (e.g. 3.9 -> 3.9.x)
40+
if command -v pyenv &> /dev/null; then
41+
PYENV_MATCH=$(pyenv versions --bare | grep "^${PYTHON_VERSION//./\\.}" | head -1)
42+
if [ -n "$PYENV_MATCH" ]; then
43+
pyenv local "$PYENV_MATCH"
44+
log "[Info] pyenv local set to $PYENV_MATCH"
45+
fi
46+
fi
47+
48+
log "[Info] Checking if ${PYTHON} is available..."
49+
which ${PYTHON} || { log "[ERROR] ${PYTHON} not found in PATH, skipping"; continue; }
50+
${PYTHON} --version
51+
2852
# Need to create a venv to update build dependencies
53+
log "[Info] Creating venv at ${VENV_DIR}..."
2954
${PYTHON} -m venv ${VENV_DIR}
3055
source ${VENV_DIR}/bin/activate
31-
echo "[Info] Created and activated new venv at ${VENV_DIR}"
56+
log "[Info] Created and activated new venv at ${VENV_DIR}"
3257

3358
# Build
34-
echo "[Info] Creating a wheel: snowflake_connector using $PYTHON"
59+
log "[Info] Creating a wheel: snowflake_connector using $PYTHON"
3560
# Clean up possible build artifacts
3661
rm -rf build generated_version.py
3762
# Update PEP-517 dependencies
63+
log "[Info] Upgrading pip, setuptools, wheel, build..."
3864
python -m pip install -U pip setuptools wheel build
65+
log "[Info] pip install complete"
3966
# Use new PEP-517 build
67+
log "[Info] Running python -m build --wheel ..."
4068
python -m build --wheel .
69+
log "[Info] python -m build complete"
4170
deactivate
42-
echo "[Info] Deleting venv at ${VENV_DIR}"
71+
log "[Info] Deleting venv at ${VENV_DIR}"
4372
rm -rf ${VENV_DIR}
73+
log "[Info] ===== Finished build for Python ${PYTHON_VERSION} ====="
4474
done
75+
76+
log "[Info] build_darwin.sh finished successfully"

ci/set_base_image.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
#!/bin/bash -e
22
#
33
# Use the internal docker registry if running on Jenkins
4+
# Artifactory virtual repos support anonymous access; authentication
5+
# is handled via "sf artifact oci auth" in the Jenkinsfile.
46
#
57
set -o pipefail
6-
INTERNAL_REPO=nexus.int.snowflakecomputing.com:8086
7-
if [[ -n "$NEXUS_PASSWORD" ]]; then
8+
INTERNAL_REPO=artifactory.ci1.us-west-2.aws-dev.app.snowflake.com/internal-production-docker-snowflake-virtual
9+
if [[ -n "$JENKINS_HOME" ]]; then
810
echo "[INFO] Pull docker images from $INTERNAL_REPO"
9-
NEXUS_USER=${USERNAME:-jenkins}
10-
docker login --username "$NEXUS_USER" --password "$NEXUS_PASSWORD" $INTERNAL_REPO
11-
export BASE_IMAGE_MANYLINUX2014=nexus.int.snowflakecomputing.com:8086/docker/manylinux2014_x86_64:2025.02.12-1
12-
export BASE_IMAGE_MANYLINUX2014AARCH64=nexus.int.snowflakecomputing.com:8086/docker/manylinux2014_aarch64:2025.02.12-1
11+
export BASE_IMAGE_MANYLINUX2014=$INTERNAL_REPO/docker/manylinux2014_x86_64:latest
12+
export BASE_IMAGE_MANYLINUX2014AARCH64=$INTERNAL_REPO/docker/manylinux2014_aarch64:latest
13+
export BASE_IMAGE_ROCKYLINUX9=$INTERNAL_REPO/docker/rockylinux:9
1314
else
1415
echo "[INFO] Pull docker images from public registry"
1516
export BASE_IMAGE_MANYLINUX2014=quay.io/pypa/manylinux2014_x86_64
1617
export BASE_IMAGE_MANYLINUX2014AARCH64=quay.io/pypa/manylinux2014_aarch64
18+
export BASE_IMAGE_ROCKYLINUX9=rockylinux:9
1719
fi

ci/test_authentication.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ docker run \
2525
-v $(cd $THIS_DIR/.. && pwd):/mnt/host \
2626
-v $WORKSPACE:/mnt/workspace \
2727
--rm \
28-
nexus.int.snowflakecomputing.com:8086/docker/snowdrivers-test-external-browser-python:3 \
28+
artifactory.ci1.us-west-2.aws-dev.app.snowflake.com/internal-production-docker-snowflake-virtual/docker/snowdrivers-test-external-browser-python:3 \
2929
"/mnt/host/ci/container/test_authentication.sh"

0 commit comments

Comments
 (0)