-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SNOW-920995 add CI configuration for regression tests (#1075)
- Loading branch information
1 parent
bcb26f9
commit 5b174a3
Showing
19 changed files
with
301 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import groovy.json.JsonOutput | ||
|
||
|
||
timestamps { | ||
node('regular-memory-node') { | ||
stage('checkout') { | ||
scmInfo = checkout scm | ||
println("${scmInfo}") | ||
env.GIT_BRANCH = scmInfo.GIT_BRANCH | ||
env.GIT_COMMIT = scmInfo.GIT_COMMIT | ||
} | ||
params = [ | ||
string(name: 'svn_revision', value: 'main'), | ||
string(name: 'branch', value: 'main'), | ||
string(name: 'client_git_commit', value: scmInfo.GIT_COMMIT), | ||
string(name: 'client_git_branch', value: scmInfo.GIT_BRANCH), | ||
string(name: 'TARGET_DOCKER_TEST_IMAGE', value: 'go-centos7-go1.19'), | ||
string(name: 'parent_job', value: env.JOB_NAME), | ||
string(name: 'parent_build_number', value: env.BUILD_NUMBER) | ||
] | ||
stage('Test') { | ||
build job: 'RT-LanguageGo-PC',parameters: params | ||
} | ||
} | ||
} | ||
|
||
|
||
pipeline { | ||
agent { label 'regular-memory-node' } | ||
options { timestamps() } | ||
environment { | ||
COMMIT_SHA_LONG = sh(returnStdout: true, script: "echo \$(git rev-parse " + "HEAD)").trim() | ||
|
||
// environment variables for semgrep_agent (for findings / analytics page) | ||
// remove .git at the end | ||
// remove SCM URL + .git at the end | ||
|
||
BASELINE_BRANCH = "${env.CHANGE_TARGET}" | ||
} | ||
stages { | ||
stage('Checkout') { | ||
steps { | ||
checkout scm | ||
} | ||
} | ||
} | ||
} | ||
|
||
def wgetUpdateGithub(String state, String folder, String targetUrl, String seconds) { | ||
def ghURL = "https://api.github.com/repos/snowflakedb/gosnowflake/statuses/$COMMIT_SHA_LONG" | ||
def data = JsonOutput.toJson([state: "${state}", context: "jenkins/${folder}",target_url: "${targetUrl}"]) | ||
sh "wget ${ghURL} --spider -q --header='Authorization: token $GIT_PASSWORD' --post-data='${data}'" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash -e | ||
|
||
export PLATFORM=$(echo $(uname) | tr '[:upper:]' '[:lower:]') | ||
# Use the internal Docker Registry | ||
export INTERNAL_REPO=nexus.int.snowflakecomputing.com:8086 | ||
export DOCKER_REGISTRY_NAME=$INTERNAL_REPO/docker | ||
export WORKSPACE=${WORKSPACE:-/tmp} | ||
|
||
export DRIVER_NAME=go | ||
|
||
TEST_IMAGE_VERSION=1 | ||
declare -A TEST_IMAGE_NAMES=( | ||
[$DRIVER_NAME-centos7-go1.19]=$DOCKER_REGISTRY_NAME/client-$DRIVER_NAME-centos7-go1.19-test:$TEST_IMAGE_VERSION | ||
) | ||
export TEST_IMAGE_NAMES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -o pipefail | ||
|
||
CI_SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
TOPDIR=$(cd $CI_SCRIPTS_DIR/../.. && pwd) | ||
|
||
cd $TOPDIR | ||
cp parameters.json.local parameters.json | ||
make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
FROM centos:7 | ||
|
||
# update OS and install basic tools | ||
RUN yum -y update && \ | ||
yum -y install epel-release && \ | ||
yum -y install centos-release-scl && \ | ||
yum -y install git && \ | ||
yum -y install which && \ | ||
yum -y install zstd && \ | ||
yum -y install jq | ||
|
||
# gosu | ||
RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.11/gosu-amd64" | ||
RUN chmod +x /usr/local/bin/gosu | ||
|
||
# Install build tools | ||
RUN yum -y groupinstall 'Development Tools' | ||
RUN yum -y install centos-release-scl | ||
RUN yum -y install devtoolset-8-gcc* | ||
SHELL [ "/usr/bin/scl", "enable", "devtoolset-8"] | ||
|
||
# python | ||
RUN yum -y install python36 | ||
RUN python3 -V | ||
|
||
# install Go | ||
RUN curl -O -L https://go.dev/dl/go1.19.13.linux-amd64.tar.gz && \ | ||
tar -C /usr/local -xzf go1.19.13.linux-amd64.tar.gz | ||
ENV GOROOT /usr/local/go | ||
ENV GOPATH=/tmp/go | ||
ENV GOCACHE=/tmp/cache | ||
ENV PATH=$PATH:$GOROOT/bin:$GOPATH/bin | ||
ENV CGO_ENABLED=1 | ||
|
||
# workspace | ||
RUN mkdir -p /home/user && \ | ||
chmod 777 /home/user | ||
WORKDIR /home/user | ||
|
||
# entry point | ||
COPY scripts/entrypoint.sh /usr/local/bin/entrypoint.sh | ||
RUN chmod +x /usr/local/bin/entrypoint.sh | ||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash -e | ||
# | ||
# Build Docker images | ||
# | ||
set -o pipefail | ||
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
source $THIS_DIR/../_init.sh | ||
|
||
for name in "${!TEST_IMAGE_NAMES[@]}"; do | ||
docker build \ | ||
--platform linux/amd64 \ | ||
--file $THIS_DIR/Dockerfile.$name-test \ | ||
--label snowflake \ | ||
--label $DRIVER_NAME \ | ||
--tag ${TEST_IMAGE_NAMES[$name]} . | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash -x | ||
# Add local user | ||
# Either use the LOCAL_USER_ID if passed in at runtime or | ||
# fallback | ||
|
||
USER_ID=${LOCAL_USER_ID:-9001} | ||
|
||
echo "Starting with UID : $USER_ID" | ||
useradd --shell /bin/bash -u $USER_ID -o -c "" -m user | ||
export HOME=/home/user | ||
|
||
exec /usr/local/bin/gosu user "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash -e | ||
# | ||
# Build Docker images | ||
# | ||
set -o pipefail | ||
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
source $THIS_DIR/../_init.sh | ||
|
||
source $THIS_DIR/../scripts/login_internal_docker.sh | ||
|
||
for image in $(docker images --format "{{.ID}},{{.Repository}}:{{.Tag}}" | grep "nexus.int.snowflakecomputing.com" | grep "client-$DRIVER_NAME"); do | ||
target_id=$(echo $image | awk -F, '{print $1}') | ||
target_name=$(echo $image | awk -F, '{print $2}') | ||
for name in "${!TEST_IMAGE_NAMES[@]}"; do | ||
if [[ "$target_name" == "${TEST_IMAGE_NAMES[$name]}" ]]; then | ||
echo $name | ||
docker_hub_image_name=$(echo ${TEST_IMAGE_NAMES[$name]/$DOCKER_REGISTRY_NAME/snowflakedb}) | ||
set -x | ||
docker tag $target_id $docker_hub_image_name | ||
set +x | ||
docker push "${TEST_IMAGE_NAMES[$name]}" | ||
fi | ||
done | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash -e | ||
# | ||
# Login the Internal Docker Registry | ||
# | ||
if [[ -z "$GITHUB_ACTIONS" ]]; then | ||
echo "[INFO] Login the internal Docker Resistry" | ||
NEXUS_USER=${USERNAME:-jenkins} | ||
if [[ -z "$NEXUS_PASSWORD" ]]; then | ||
echo "[ERROR] Set NEXUS_PASSWORD to your LDAP password to access the internal repository!" | ||
exit 1 | ||
fi | ||
if ! docker login --username "$NEXUS_USER" --password "$NEXUS_PASSWORD" $INTERNAL_REPO; then | ||
echo "[ERROR] Failed to connect to the nexus server. Verify the environment variable NEXUS_PASSWORD is set correctly for NEXUS_USER: $NEXUS_USER" | ||
exit 1 | ||
fi | ||
else | ||
echo "[INFO] No login the internal Docker Registry" | ||
fi |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"testconnection": { | ||
"SNOWFLAKE_TEST_HOST": "snowflake.reg.local", | ||
"SNOWFLAKE_TEST_PROTOCOL": "http", | ||
"SNOWFLAKE_TEST_PORT": "8082", | ||
"SNOWFLAKE_TEST_USER": "snowman", | ||
"SNOWFLAKE_TEST_PASSWORD": "test", | ||
"SNOWFLAKE_TEST_ACCOUNT": "s3testaccount", | ||
"SNOWFLAKE_TEST_WAREHOUSE": "regress", | ||
"SNOWFLAKE_TEST_DATABASE": "testdb", | ||
"SNOWFLAKE_TEST_SCHEMA": "testschema", | ||
"SNOWFLAKE_TEST_ROLE": "sysadmin" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.