Skip to content

Commit

Permalink
chore: add new boot-lh-ghe context
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Bayer <[email protected]>
  • Loading branch information
abayer authored and jenkins-x-bot committed Jan 14, 2020
1 parent fdb7576 commit 773cd99
Show file tree
Hide file tree
Showing 7 changed files with 330 additions and 0 deletions.
21 changes: 21 additions & 0 deletions boot-vault.platform.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,28 @@ jenkins:
EnvVars:
CODECOV_TOKEN: $CODECOV_TOKEN

{{- if eq .Requirements.webhook "lighthouse" }}
controllerbuild:
enabled: true
args:
- "controller"
- "build"
- "--git-reporting"
- "--batch-mode"
- "--git-credentials"
- "--verbose"
image:
repository: gcr.io/jenkinsxio/builder-go
tag: $VERSION
{{- else }}
controllerbuild:
enabled: true
args:
- "controller"
- "build"
- "--batch-mode"
- "--verbose"
image:
repository: gcr.io/jenkinsxio/builder-go
tag: $VERSION
{{- end }}
159 changes: 159 additions & 0 deletions jenkins-x-boot-lh-ghe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
buildPack: none
pipelineConfig:
pipelines:
pullRequest:
pipeline:
agent:
image: gcr.io/kaniko-project/executor:9912ccbf8d22bbafbf971124600fbb0b13b9cbd6
options:
containerOptions:
resources:
limits:
cpu: 4
memory: 6144Mi
requests:
cpu: 1
memory: 2048Mi
stages:
- name: build
environment:
- name: GIT_COMMITTER_EMAIL
value: [email protected]
- name: GIT_AUTHOR_EMAIL
value: [email protected]
- name: GIT_AUTHOR_NAME
value: jenkins-x-bot
- name: GIT_COMMITTER_NAME
value: jenkins-x-bot
- name: BASE_WORKSPACE
value: /workspace/source
- name: GOPROXY
value: http://jenkins-x-athens-proxy:80
- name: PARALLEL_BUILDS
value: "2"
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /secrets/kaniko/kaniko-secret.json
- name: DISABLE_TEST_CACHING
value: "true"
options:
volumes:
- name: kaniko-secret
secret:
secretName: kaniko-secret
items:
- key: kaniko-secret
path: kaniko/kaniko-secret.json
containerOptions:
volumeMounts:
- name: kaniko-secret
mountPath: /secrets

steps:
- name: build-binary
image: docker.io/golang:1.12.4
command: make
args: ['linux']

- name: validate-binary
image: docker.io/golang:1.12.4
command: "./build/linux/jx"
args: ['help']

- name: build-and-push-image
command: /kaniko/executor
args: ['--dockerfile=/workspace/source/Dockerfile','--destination=gcr.io/jenkinsxio/jx:${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
command: /kaniko/executor
args: ['--dockerfile=/workspace/source/Dockerfile.builder-nodejs','--destination=gcr.io/jenkinsxio/builder-nodejs:${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
command: /kaniko/executor
args: ['--dockerfile=/workspace/source/Dockerfile.builder-maven','--destination=gcr.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']

- name: build-and-push-go
command: /kaniko/executor
args: ['--dockerfile=/workspace/source/Dockerfile.builder-go','--destination=gcr.io/jenkinsxio/builder-go:${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-go-nodejs
command: /kaniko/executor
args: ['--dockerfile=/workspace/source/Dockerfile.builder-go-nodejs','--destination=gcr.io/jenkinsxio/builder-go-nodejs:${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: e2e-tests
options:
volumes:
- name: sa
secret:
secretName: bdd-secret
items:
- key: bdd-credentials.json
path: bdd/sa.json
containerOptions:
volumeMounts:
- mountPath: /secrets
name: sa
environment:
- name: GKE_SA
value: /secrets/bdd/sa.json
- name: GIT_COMMITTER_EMAIL
value: [email protected]
- name: GIT_AUTHOR_EMAIL
value: [email protected]
- name: GIT_AUTHOR_NAME
value: jenkins-x-bot
- name: GIT_COMMITTER_NAME
value: jenkins-x-bot
- name: BASE_WORKSPACE
value: /workspace/source
- name: GOPROXY
value: http://jenkins-x-athens-proxy:80
- name: PARALLEL_BUILDS
value: "2"
- name: GHE_ACCESS_TOKEN
valueFrom:
secretKeyRef:
name: jx-pipeline-git-github-ghe
key: password
- name: JENKINS_PASSWORD
valueFrom:
secretKeyRef:
name: test-jenkins-user
key: password
steps:
- name: boot-lh-ghe-e2e-tests
image: gcr.io/jenkinsxio/builder-go-nodejs:${inputs.params.version}
command: ./jx/bdd/boot-lh-ghe/ci.sh

- name: generate-report
image: gcr.io/jenkinsxio/builder-nodejs10x:0.1.607
command: jx
args:
- step
- report
- --in-dir
- /workspace/source/build/reports
- --target-report
- create_spring_application.junit.xml
- --merge
- --out-dir
- /workspace/source/build/reports
- --output-name
- junit.html
- --suite-name
- "BDD_Boot_LH_GHE_Tests"

- name: clear-kubeconfig
image: gcr.io/jenkinsxio/builder-go:${inputs.params.version}
command: rm ~/.kube/config

- name: stash_html_report
image: gcr.io/jenkinsxio/builder-go:${inputs.params.version}
command: jx
args:
- step
- stash
- -c
- e2e-tests
- -p
- "/workspace/source/build/reports/junit.html"
- --bucket-url gs://jx-prod-logs
1 change: 1 addition & 0 deletions jx/bdd/boot-lh-ghe/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## BDD test using JX Boot with Local secrets
77 changes: 77 additions & 0 deletions jx/bdd/boot-lh-ghe/ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/usr/bin/env bash
set -e
set -x

export GHE_USERNAME="dev1"
export GHE_EMAIL="[email protected]"

# fix broken `BUILD_NUMBER` env var
export BUILD_NUMBER="$BUILD_ID"

JX_HOME="/tmp/jxhome"
KUBECONFIG="/tmp/jxhome/config"

# lets avoid the git/credentials causing confusion during the test
export XDG_CONFIG_HOME=$JX_HOME

mkdir -p $JX_HOME/git

jx --version

# replace the credentials file with a single user entry
echo "https://$GHE_USERNAME:$GHE_ACCESS_TOKEN@github.beescloud.com" > $JX_HOME/git/credentials

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

# lets setup git
git config --global --add user.name JenkinsXBot
git config --global --add user.email [email protected]

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

sed -e s/\$VERSION/${VERSION_PREFIX}${VERSION}/g -e s/\$CODECOV_TOKEN/${CODECOV_TOKEN}/g boot-vault.platform.yaml.template > boot-vault.platform.yaml

# setup jx boot parameters
export JX_VALUE_ADMINUSER_PASSWORD="$JENKINS_PASSWORD"
export JX_VALUE_PIPELINEUSER_USERNAME="$GHE_USERNAME"
export JX_VALUE_PIPELINEUSER_EMAIL="$GHE_EMAIL"
export JX_VALUE_PIPELINEUSER_TOKEN="$GHE_ACCESS_TOKEN"
export JX_VALUE_PROW_HMACTOKEN="$GHE_ACCESS_TOKEN"

# TODO temporary hack until the batch mode in jx is fixed...
export JX_BATCH_MODE="true"

# Use the latest boot config promoted in the version stream instead of master to avoid conflicts during boot, because
# boot fetches always the latest version available in the version stream.
git clone https://github.com/jenkins-x/jenkins-x-versions.git versions
export BOOT_CONFIG_VERSION=$(jx step get dependency-version --host=github.com --owner=jenkins-x --repo=jenkins-x-boot-config --dir versions | sed 's/.*: \(.*\)/\1/')
git clone https://github.com/jenkins-x/jenkins-x-boot-config.git boot-source
cd boot-source
git checkout tags/v${BOOT_CONFIG_VERSION} -b latest-boot-config

cp ../jx/bdd/boot-lh-ghe/jx-requirements.yml .
cp ../jx/bdd/boot-lh-ghe/parameters.yaml env

cp env/jenkins-x-platform/values.tmpl.yaml tmp.yaml
cat tmp.yaml ../boot-vault.platform.yaml > env/jenkins-x-platform/values.tmpl.yaml
rm tmp.yaml

# TODO hack until we fix boot to do this too!
helm init --client-only
helm repo add jenkins-x https://storage.googleapis.com/chartmuseum.jenkins-x.io


jx step bdd \
--versions-repo https://github.com/jenkins-x/jenkins-x-versions.git \
--config ../jx/bdd/boot-lh-ghe/cluster.yaml \
--gopath /tmp \
--git-provider=github \
--git-provider-url https://github.beescloud.com \
--git-username $GHE_USERNAME \
--git-api-token $GHE_ACCESS_TOKEN \
--default-admin-password $JENKINS_PASSWORD \
--no-delete-app \
--no-delete-repo \
--tests install \
--tests test-quickstart-golang-http \
--tests test-app-lifecycle
18 changes: 18 additions & 0 deletions jx/bdd/boot-lh-ghe/cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
clusters:
- name: boot-lh-ghe
args:
- create
- cluster
- gke
- --project-id=jenkins-x-bdd3
- -m=n1-standard-2
- --min-num-nodes=3
- --max-num-nodes=5
- -z=europe-west1-c
- --skip-login
- --skip-installation
commands:
- command: jx
args:
- boot
- -b
46 changes: 46 additions & 0 deletions jx/bdd/boot-lh-ghe/jx-requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
gitops: true
cluster:
clusterName: bdd-boot-lh-ghe
environmentGitOwner: dev1
gitKind: github
gitName: ghe
gitServer: https://github.beescloud.com
project: jenkins-x-bdd3
provider: gke
zone: europe-west1-c
environments:
- key: dev
owner: ""
repository: ""
- key: staging
owner: ""
repository: ""
- key: production
owner: ""
repository: ""
ingress:
domain: ""
externalDNS: false
tls:
email: ""
enabled: false
production: false
kaniko: true
secretStorage: vault
storage:
logs:
enabled: false
url: ""
reports:
enabled: false
url: ""
repository:
enabled: false
url: ""
webhook: lighthouse
vault:
disableURLDiscovery: true
versionStream:
ref: "master"
url: https://github.com/jenkins-x/jenkins-x-versions.git

8 changes: 8 additions & 0 deletions jx/bdd/boot-lh-ghe/parameters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
adminUser:
username: admin
enableDocker: false
gpg: {}
pipelineUser:
username: dev1
email: [email protected]

0 comments on commit 773cd99

Please sign in to comment.