File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,21 +8,18 @@ RUN mkdir -p $GOPATH/pkg/mod && chmod -R 777 $GOPATH/pkg/mod
88
99RUN chown -R root:root $GOPATH/pkg/mod && chmod -R g+rwx $GOPATH/pkg/mod
1010
11- ENV WORKSPACE ${GOPATH}/src/github.com/rancher/terraform-provider-rancher2/tfp-automation
11+ WORKDIR /usr/app/src
1212
13- WORKDIR $WORKSPACE
13+ COPY [ "." , "$WORKDIR" ]
1414
15- COPY ["." , "$WORKSPACE" ]
15+ ADD ./* ./
16+ SHELL ["/bin/bash" , "-c" ]
1617
1718RUN go mod download && \
1819 go install gotest.tools/gotestsum@latest
1920
20- COPY . .
21-
2221ARG TERRAFORM_VERSION=0.13.7
2322RUN wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && apt-get update && apt-get install unzip && unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip && rm terraform_${TERRAFORM_VERSION}_linux_amd64.zip && chmod u+x terraform && mv terraform /usr/bin/terraform
2423
2524ARG CONFIG_FILE
26- COPY ${CONFIG_FILE} /config.yml
27-
28- SHELL ["/bin/bash" , "-c" ]
25+ COPY ${CONFIG_FILE} /config.yml
Original file line number Diff line number Diff line change 1- pipeline {
2- agent any
3-
4- stages {
1+ #! groovy
2+ node {
3+ def branch = ' master'
4+ def repo = scm. userRemoteConfigs
5+
6+ if (" ${ env.REPO} " != " null" && " ${ env.REPO} " != " " ) {
7+ repo = [[url : " ${ env.REPO} " ]]
8+ }
9+ stage(' Checkout' ) {
10+ deleteDir()
11+ checkout([
12+ $class : ' GitSCM' ,
13+ branches : [[name : " */${ branch} " ]],
14+ extensions : scm. extensions + [[$class : ' CleanCheckout' ]],
15+ userRemoteConfigs : repo
16+ ])
17+ }
518 stage(' Build Docker image' ) {
6- steps {
7- script {
8- writeFile file : ' config.yml' , text : params. CONFIG
19+ writeFile file : ' config.yml' , text : env. CONFIG
920 env. CATTLE_TEST_CONFIG = ' /home/jenkins/workspace/rancher_qa/tfp-automation/config.yml'
10- sh ' docker build --build-arg CONFIG_FILE=config.yml -t tfp-automation .'
11- }
12- }
21+ sh ' docker build --build-arg CONFIG_FILE=config.yml -f tfp-automation/Dockerfile -t tfp-automation . '
1322 }
14-
23+
1524 stage(' Run Module Test' ) {
16- steps {
17- script {
1825 def dockerImage = docker. image(' tfp-automation' )
1926 dockerImage. inside() {
2027 sh " go test -v -timeout 1h -run ${ params.TEST_CASE} ./tfp-automation/tests/cluster"
2128 }
22- }
23- }
2429 }
25- }
2630}
You can’t perform that action at this time.
0 commit comments