Skip to content

Commit

Permalink
Merge branch 'master' into SNOW-1524152-implement-setQueryTimeout-for…
Browse files Browse the repository at this point in the history
…-async-queries
  • Loading branch information
sfc-gh-ext-simba-jf authored Dec 12, 2024
2 parents 30b657f + 7c29846 commit bfa2093
Showing 1 changed file with 1 addition and 39 deletions.
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

0 comments on commit bfa2093

Please sign in to comment.