Skip to content

Instantly share code, notes, and snippets.

@cccaternberg
Last active August 1, 2018 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cccaternberg/df91edae6c04d99cb17272ac6bdbeceb to your computer and use it in GitHub Desktop.
Save cccaternberg/df91edae6c04d99cb17272ac6bdbeceb to your computer and use it in GitHub Desktop.
jx-gke
#create the cluster
##These include Jenkins a CI/CD pipeline solution
##Nexus - an artifact repository
##Chartmuseum - a Helm Chart repository
##Monocular which provides a Web UI for searching and discovering charts deployed into your cluster via Jenkins X.
#jx create cluster gke --cluster-name='jx-acaternberg' --labels='created-by-acaternberg'
#jx create cluster gke --skip-login --default-admin-password=mySecretPassWord123 -n jx-acaternberg
jx create cluster gke
#create a spring-boot application
##create a new Spring Boot application in a subdirectory
##add your source code into a git repository
##create a remote git repository on a git service and pushes the code
##adds default files:
###Dockerfile to build your application as a docker image
###Jenkinsfile to implement the CI / CD pipeline
###helm chart to run your application inside Kubernetes
##register a webhook on the remote git repository to your teams Jenkins
##add the git repository to your teams
##trigger the first pipeline
jx create spring -d web -d actuator
#SEE GIT REPO IN WEBBROWSER
#see build logs
##first build needs longer because all maven deps are downloaded
##dependencies were cahced to nexus repo within the jx cluster
##a snapshot and release were pushed to nexus so artifacts can be shared between teams
##docker image were created anbd poushed to the ingternal docker-registry
##changelog were generated
##publisched to a chartmuseum chart registry
## a pipeline is waiting for a pullrequest on a staging envirement to be merged
## another pipeline is waiting to be triggerd to perform the deployment to staging envoriment using HELM
jx get build logs cccaternberg/jx-spring-demo/master
jx get activity -f jx-spring-demo -w
jx get apps
#see versions and URL
#Open URL in webrowser
#NOT USED
#see versions
#jx open --env staging
# Let's now create a homepage with an pullrequest
cd jx-spring-demo
jx create issue -t "add a homepage #1"
git checkout -b wip
vi src/main/resources/static/index.html
<!DOCTYPE html>
<html>
<body>
<p>Hallo Welt! Hier bin ich!</p>
<img src="https://wiki.jenkins.io/download/attachments/2916393/logo.png?version=1&modificationDate=1302753947000&api=v2">
</body>
</html>
#commit and push to orgin
git add .
git commit -m "hp added #1"
git push origin wip
#create an pull request with hub
#hub is a command line tool that wraps git in order to extend it with extra features and commands that make working with
hub pull-request
#because we have an webhook a PR a pipeline is automativcally triggered for this PR
#DO open pull request in web-browser and wait for availability of preview env!!
# A preview enviroment is avalable for this PR until the PR is merged
#DO click on link in GitHub PR as sonn as it shows the preview link
jx get build logs # to see the build for the PR
#DO wait until build s finished
jx get apps # to sse that next version is deployed to staging
# DO openn webbrowser and see releases-> changelog and issues
# close issue
#promote to production stage
#jx promote --version 0.0.7 --env production --timeout 1h -a demo1
jx promote --version 0.0.7 --env production --timeout 1h
#get clusters
kubectl config get-clusters
#get urls
jx get urls
#jx import hellonode
jx create spring
jx create spring -d web -d actuator
jx get activity -f jx-spring-demo -w
jx get build logs cccaternberg/jx-spring-demo/master
jx get pipelines
#create env
jx create env -n test -l Test --no-gitops --namespace jx-spring-test
#project actions
Watch pipeline activity via: jx get activity -f hellonode -w
Browse the pipeline log via: jx get build logs cccaternberg/hellonode/master
Open the Jenkins console via jx console
You can list the pipelines via: jx get pipelines
When the pipeline is complete: jx get applications
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment