Skip to content

Commit

Permalink
chore: Updating tekton BDD tests to run and be covered
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
  • Loading branch information
abayer committed Jun 17, 2019
1 parent ae0c16c commit 63f0fa6
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 14 deletions.
51 changes: 47 additions & 4 deletions jenkins-x-tekton.yml
Expand Up @@ -22,6 +22,28 @@ pipelineConfig:
value: http://jenkins-x-athens-proxy:80
- name: PARALLEL_BUILDS
value: "2"
# Build a binary that can emit coverage
- name: COVERED_BINARY
value: "true"
- name: CODECOV_NAME
value: tekton-e2e
- name: VERSION_PREFIX
value: covered-
options:
containerOptions:
resources:
limits:
cpu: 4
memory: 6144Mi
requests:
cpu: 3
memory: 3072Mi
env:
- name: CODECOV_TOKEN
valueFrom:
secretKeyRef:
key: token
name: codecov-token

steps:
- name: build-binary
Expand All @@ -32,13 +54,34 @@ pipelineConfig:
- name: validate-binary
image: docker.io/golang:1.11.5
command: "./build/linux/jx"
args: ['--help']
args: ['help']

- name: build-and-push-image
image: rawlingsj/executor:dev40
command: /kaniko/executor
args: ['--dockerfile=/workspace/source/Dockerfile','--destination=docker.io/jenkinsxio/jx:covered-${inputs.params.version}','--context=/workspace/source','--cache-repo=jenkins-x-docker-registry.jx.svc.cluster.local:5000/','--cache=true','--cache-dir=/workspace','--skip-tls-verify-registry=jenkins-x-docker-registry.jx.svc.cluster.local:5000']

- name: build-and-push-nodejs
image: rawlingsj/executor:dev40
command: /kaniko/executor
args: ['--dockerfile=/workspace/source/Dockerfile.builder-nodejs','--destination=docker.io/jenkinsxio/builder-nodejs:covered-${inputs.params.version}','--context=/workspace/source','--cache-repo=jenkins-x-docker-registry.jx.svc.cluster.local:5000/','--cache=true','--cache-dir=/workspace','--skip-tls-verify-registry=jenkins-x-docker-registry.jx.svc.cluster.local:5000']

- name: build-and-push-maven
image: gcr.io/kaniko-project/executor:9912ccbf8d22bbafbf971124600fbb0b13b9cbd6
image: rawlingsj/executor:dev40
command: /kaniko/executor
args: ['--dockerfile=/workspace/source/Dockerfile.builder-maven','--destination=docker.io/jenkinsxio/builder-maven:${inputs.params.version}','--context=/workspace/source','--cache-repo=jenkins-x-docker-registry.jx.svc.cluster.local:5000/','--cache=true','--cache-dir=/workspace','--skip-tls-verify-registry=jenkins-x-docker-registry.jx.svc.cluster.local:5000']
args: ['--dockerfile=/workspace/source/Dockerfile.builder-maven','--destination=docker.io/jenkinsxio/builder-maven:covered-${inputs.params.version}','--context=/workspace/source','--cache-repo=jenkins-x-docker-registry.jx.svc.cluster.local:5000/','--cache=true','--cache-dir=/workspace','--skip-tls-verify-registry=jenkins-x-docker-registry.jx.svc.cluster.local:5000']

- name: preview
- name: build-and-push-go
image: rawlingsj/executor:dev40
command: /kaniko/executor
args: ['--dockerfile=/workspace/source/Dockerfile.builder-go','--destination=docker.io/jenkinsxio/builder-go:covered-${inputs.params.version}','--context=/workspace/source','--cache-repo=jenkins-x-docker-registry.jx.svc.cluster.local:5000/','--cache=true','--cache-dir=/workspace','--skip-tls-verify-registry=jenkins-x-docker-registry.jx.svc.cluster.local:5000']

- name: tekton-e2e-tests
image: gcr.io/jenkinsxio/builder-go:0.1.451
command: ./jx/bdd/tekton/ci.sh

- name: stash-test-results
image: jenkinsxio/jx:2.0.128
command: jx
# TODO force it to use the gs bucket until we sort out why the team setting gets wiped
args: ['step', 'stash', '-c', 'tekton-e2e-tests', '-p', 'build/reports/junit.xml', '--bucket-url', 'gs://jx-prod-logs']
17 changes: 12 additions & 5 deletions jx/bdd/tekton/ci.sh
Expand Up @@ -2,12 +2,16 @@
set -e
set -x

echo "verifying Pull Request"
JX=./build/linux/jx

export GH_USERNAME="jenkins-x-bot-test"
export GH_OWNER="cb-kubecd"

export GH_CREDS_PSW="$(jx step credential -s jenkins-x-bot-test-github)"
export JENKINS_CREDS_PSW="$(jx step credential -s test-jenkins-user)"
export GH_CREDS_PSW="$(jx step credential -s jenkins-x-bot-test-github | sed -e 's/PASS//' -e 's/coverage: [0-9\.]*% of statements in [\w\.\/]*//' | tr -d [:space:])"
export JENKINS_CREDS_PSW="$(jx step credential -s test-jenkins-user | sed -e 's/PASS//' -e 's/coverage: [0-9\.]*% of statements in [\w\.\/]*//' | tr -d [:space:])"
export GKE_SA="$(jx step credential -k bdd-credentials.json -s bdd-secret -f sa.json)"
export REPORTS_DIR="${BASE_WORKSPACE}/build/reports"

# fix broken `BUILD_NUMBER` env var
export BUILD_NUMBER="$BUILD_ID"
Expand All @@ -17,12 +21,13 @@ KUBECONFIG="/tmp/jxhome/config"

mkdir -p $JX_HOME

jx --version
jx step git credentials
# Disable coverage for jx version as we don't validate the output at all
COVER_JX_BINARY=false ${JX} version
${JX} step git credentials

gcloud auth activate-service-account --key-file $GKE_SA

sed s/\$VERSION/${VERSION}/g myvalues.yaml.tekton.template > myvalues.yaml
sed -e s/\$VERSION/${VERSION_PREFIX}${VERSION}/g -e s/\$CODECOV_TOKEN/${CODECOV_TOKEN}/g myvalues.yaml.tekton.template > myvalues.yaml

echo the myvalues.yaml file is:
cat myvalues.yaml
Expand All @@ -31,6 +36,8 @@ cat myvalues.yaml
git config --global --add user.name JenkinsXBot
git config --global --add user.email jenkins-x@googlegroups.com

cp ${JX} /usr/bin

echo "running the BDD tests with JX_HOME = $JX_HOME"

jx step bdd --versions-repo https://github.com/jenkins-x/jenkins-x-versions.git --config jx/bdd/tekton/cluster.yaml --gopath /tmp --git-provider=github --git-username $GH_USERNAME --git-owner $GH_OWNER --git-api-token $GH_CREDS_PSW --default-admin-password $JENKINS_CREDS_PSW --no-delete-app --no-delete-repo --tekton --tests install --tests test-create-spring
Expand Down
27 changes: 22 additions & 5 deletions myvalues.yaml.tekton.template
@@ -1,5 +1,22 @@
pipelinerunner:
enabled: "true"
image:
repository: jenkinsxio/builder-maven
tag: $VERSION
# override the build pod images
jenkins:
Agent:
PodTemplates:
Maven:
Containers:
Maven:
Image: jenkinsxio/builder-maven:$VERSION
EnvVars:
CODECOV_TOKEN: $CODECOV_TOKEN
Nodejs:
Containers:
Nodejs:
Image: jenkinsxio/builder-nodejs:$VERSION
EnvVars:
CODECOV_TOKEN: $CODECOV_TOKEN
Go:
Containers:
Go:
Image: jenkinsxio/builder-go:$VERSION
EnvVars:
CODECOV_TOKEN: $CODECOV_TOKEN

0 comments on commit 63f0fa6

Please sign in to comment.