github.com/snowflakedb/gosnowflake@v1.9.0/Jenkinsfile (about)

     1  import groovy.json.JsonOutput
     2  
     3  
     4  timestamps {
     5    node('regular-memory-node') {
     6      stage('checkout') {
     7        scmInfo = checkout scm
     8        println("${scmInfo}")
     9        env.GIT_BRANCH = scmInfo.GIT_BRANCH
    10        env.GIT_COMMIT = scmInfo.GIT_COMMIT
    11      }
    12      params = [
    13        string(name: 'svn_revision', value: 'main'),
    14        string(name: 'branch', value: 'main'),
    15        string(name: 'client_git_commit', value: scmInfo.GIT_COMMIT),
    16        string(name: 'client_git_branch', value: scmInfo.GIT_BRANCH),
    17        string(name: 'TARGET_DOCKER_TEST_IMAGE', value: 'go-centos7-go1.19'),
    18        string(name: 'parent_job', value: env.JOB_NAME),
    19        string(name: 'parent_build_number', value: env.BUILD_NUMBER)
    20      ]
    21      stage('Test') {
    22        build job: 'RT-LanguageGo-PC',parameters: params
    23      }
    24    }
    25  }
    26  
    27  
    28  pipeline {
    29    agent { label 'regular-memory-node' }
    30    options { timestamps() }
    31    environment {
    32      COMMIT_SHA_LONG = sh(returnStdout: true, script: "echo \$(git rev-parse " + "HEAD)").trim()
    33  
    34      // environment variables for semgrep_agent (for findings / analytics page)
    35      // remove .git at the end
    36      // remove SCM URL + .git at the end
    37  
    38      BASELINE_BRANCH = "${env.CHANGE_TARGET}"
    39    }
    40    stages {
    41      stage('Checkout') {
    42        steps {
    43          checkout scm
    44        }
    45      }
    46    }
    47  }
    48  
    49  def wgetUpdateGithub(String state, String folder, String targetUrl, String seconds) {
    50      def ghURL = "https://api.github.com/repos/snowflakedb/gosnowflake/statuses/$COMMIT_SHA_LONG"
    51      def data = JsonOutput.toJson([state: "${state}", context: "jenkins/${folder}",target_url: "${targetUrl}"])
    52      sh "wget ${ghURL} --spider -q --header='Authorization: token $GIT_PASSWORD' --post-data='${data}'"
    53  }