Skip to content
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

SNOW-1852300 use bptp-built tag for svn_revision #2001

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 1 addition & 39 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ timestamps {
'''.stripMargin()
}

def commit_hash = "main" // default which we want to override
def bptp_tag = "bptp-built"
try {
def response = authenticatedGithubCall("https://api.github.com/repos/snowflakedb/snowflake/git/ref/tags/${bptp_tag}")
commit_hash = response.object.sha
} catch (Exception e) {
println("error when calling Github API: ${e.message}")
e.printStackTrace()
}

jdkToParams = ['openjdk8': 'jdbc-centos7-openjdk8', 'openjdk11': 'jdbc-centos7-openjdk11', 'openjdk17': 'jdbc-centos7-openjdk17', 'openjdk21': 'jdbc-centos7-openjdk21'].collectEntries { jdk, image ->
return [(jdk): [
string(name: 'client_git_branch', value: scmInfo.GIT_BRANCH),
Expand All @@ -66,7 +56,7 @@ timestamps {
string(name: 'parent_build_number', value: env.BUILD_NUMBER),
string(name: 'timeout_value', value: '420'),
string(name: 'PR_Key', value: scmInfo.GIT_BRANCH.substring(3)),
string(name: 'svn_revision', value: commit_hash)
string(name: 'svn_revision', value: 'bptp-built')
]]
}

Expand Down Expand Up @@ -108,34 +98,6 @@ timestamps {
}
}

// Generic github API function
// url : API url to call get command
def authenticatedGithubCall(url) {
withCredentials([
usernamePassword(credentialsId: 'jenkins-snowflakedb-github-app',
usernameVariable: 'GITHUB_USER',
passwordVariable: 'GITHUB_TOKEN'),
]) {
try {
def encodedAuth = Base64.getEncoder().encodeToString(
"${GITHUB_USER}:${GITHUB_TOKEN}".getBytes(java.nio.charset.StandardCharsets.UTF_8)
)
def authHeaderValue = "Basic ${encodedAuth}"
def connection = new URL(url).openConnection()
connection.setRequestProperty("Authorization", authHeaderValue)
if (connection.getResponseCode() >= 300) {
println("ERROR: Status fetch from ${url} returned ${connection.getResponseCode()}")
println(connection.getErrorStream().getText())
return null
}
return new groovy.json.JsonSlurperClassic().parseText(connection.getInputStream().getText())
} catch(Exception e) {
println("Exception fetching ${url}: ${e}")
return null
}
}
}

def wgetUpdateGithub(String state, String folder, String targetUrl, String seconds) {
def ghURL = "https://api.github.com/repos/snowflakedb/snowflake-jdbc/statuses/$COMMIT_SHA_LONG"
def data = JsonOutput.toJson([state: "${state}", context: "jenkins/${folder}",target_url: "${targetUrl}"])
Expand Down
Loading