Skip to content

Commit

Permalink
enhance: [skip e2e]dockerfile for milvus-sdk-go test (#35426)
Browse files Browse the repository at this point in the history
#35567

---------

Signed-off-by: Yellow Shine <[email protected]>
  • Loading branch information
yellow-shine authored Aug 20, 2024
1 parent 4d69898 commit 6e29d71
Show file tree
Hide file tree
Showing 2 changed files with 166 additions and 0 deletions.
139 changes: 139 additions & 0 deletions ci/jenkins/PR-for-go-sdk.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
@Library('[email protected]') _

def store = new java.util.concurrent.ConcurrentHashMap<String, Boolean>()

def pod = libraryResource 'io/milvus/pod/tekton-4am.yaml'
def output = [:]

pipeline {
options {
skipDefaultCheckout true
parallelsAlwaysFailFast()
buildDiscarder logRotator(artifactDaysToKeepStr: '30')
preserveStashes(buildCount: 5)
disableConcurrentBuilds(abortPrevious: true)
}
agent {
kubernetes {
cloud '4am'
yaml pod
}
}
stages {
stage('build') {
steps {
container('kubectl') {
script {
isPr = env.CHANGE_ID != null
gitMode = isPr ? 'merge' : 'fetch'
gitBaseRef = isPr ? "$env.CHANGE_TARGET" : "$env.BRANCH_NAME"

job_name = tekton.run arch: 'amd64',
isPr: isPr,
gitMode: gitMode ,
gitBaseRef: gitBaseRef,
pullRequestNumber: "$env.CHANGE_ID",
suppress_suffix_of_image_tag: true
}
}

container('tkn') {
script {
try {
tekton.print_log(job_name)
} catch (Exception e) {
println e
}

tekton.check_result(job_name)
milvus_image_tag = tekton.query_result job_name, 'milvus-image-tag'
milvus_sdk_go_image = tekton.query_result job_name, 'gotestsum-image-fqdn'
}
}
}
post {
always {
container('tkn') {
script {
tekton.sure_stop(job_name)
}
}
}
}
}
stage('E2E Test') {
matrix {
agent {
kubernetes {
cloud '4am'
yaml pod
}
}
axes {
axis {
name 'milvus_deployment_option'
values 'standalone', 'distributed'
}
}
stages {
stage('E2E Test') {
steps {
container('kubectl') {
script {
def helm_release_name = tekton.release_name milvus_deployment_option: milvus_deployment_option,
changeId: "${env.CHANGE_ID}",
buildId:"${env.BUILD_ID}"

job_name = tekton.test helm_release_name: helm_release_name,
milvus_image_tag: milvus_image_tag,
milvus_sdk_go_image: milvus_sdk_go_image,
milvus_deployment_option: milvus_deployment_option

store["${milvus_deployment_option}"] = job_name
}
}

container('tkn') {
script {
def job_name = store["${milvus_deployment_option}"]
try {
tekton.print_log(job_name)
} catch (Exception e) {
println e
}

tekton.check_result(job_name)
}
}
}

post {
always {
container('tkn') {
script {
def job_name = store["${milvus_deployment_option}"]
tekton.sure_stop(job_name)
}
}

container('archive') {
script {
def helm_release_name = tekton.release_name milvus_deployment_option: milvus_deployment_option,
changeId: "${env.CHANGE_ID}",
buildId:"${env.BUILD_ID}"

tekton.archive milvus_deployment_option: milvus_deployment_option,
release_name: helm_release_name ,
change_id: env.CHANGE_ID,
build_id: env.BUILD_ID
}
}
}
}
}
}
}
}
}
}

27 changes: 27 additions & 0 deletions tests/go_client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM golang:1.21 as builder

# Define a build argument with an empty default value
ARG CUSTOM_GOPROXY=""

# Set the GOPROXY environment variable, using the specified value if provided, or a default if not
ENV GOPROXY=${CUSTOM_GOPROXY:-https://proxy.golang.org}

RUN go install gotest.tools/[email protected]

# Set the Current Working Directory inside the container
WORKDIR /milvus

# Copy go mod and sum files
COPY client/go.mod client/go.mod
COPY client/go.sum client/go.sum
COPY tests/go_client/go.mod tests/go_client/
COPY tests/go_client/go.sum tests/go_client/

# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
RUN cd tests/go_client && go mod download

# Copy the source code into the container
COPY client client
COPY tests/go_client tests/go_client

WORKDIR /milvus/tests/go_client

0 comments on commit 6e29d71

Please sign in to comment.