Last active
April 4, 2019 10:21
-
-
Save cccaternberg/c165f283e224461e2a22340498fac957 to your computer and use it in GitHub Desktop.
jx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#create the cluster | |
jx create cluster eks -n $CLUSTER_NAME \ | |
--default-admin-password admin123! | |
These include # | |
-> Jenkins as 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. | |
#DO:SHOW INSTALL SCRIPTS IN IDEA | |
##SOME BASICS | |
-> Lets check our JenkinsX installation | |
helm init --upgrade && jx version | |
-> get URL's | |
jx get urls -n jx | |
-> We can check our environments by running | |
jx get environments | |
#DO OPEN ONE OF TARGETS DISPLAYED ENV URLS IN A WEB BROWSER | |
-> Explain env/requirements.yml | |
##create a spring-boot application | |
DEMO_APP=jx-spring-demo | |
#DO create a demo app with name $DEMO_APP in the dialog | |
jx create spring -d web -d actuator | |
-> You can create new Spring Boot applications using the "Spring Boot Initializr" | |
and then import them into Jenkins X via the `jx import command. | |
OR | |
-> You can use the jx to create the app | |
-> 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 | |
#SEE GIT REPO IN WEB BROWSER | |
#see build logs | |
--> first build needs longer because all maven dependencies are downloaded | |
--> dependencies were cached to nexus repo within the jx cluster | |
-> a snapshot and release were pushed to nexus so artifacts can be shared between teams | |
--> docker image was created and pushed to the internal docker-registry | |
--> changelog were generated | |
--> publisched to a chartmuseum chart registry | |
--> a pipeline is waiting for a pull request on a staging environment to be merged | |
--> another pipeline is waiting to be triggered to perform the deployment to staging environment using HELM | |
jx get build logs | |
#optional | |
#show buildlogs , explain whats happen | |
#jx console | |
#jx get activity -f $DEMO_APP -w | |
jx get act | |
jx get applications -n jx-staging | |
#see versions and URL | |
#Open URL in web browser | |
jx get applications -e staging | |
jx get applications -e production | |
#NOT USED | |
#see versions | |
#jx open --env staging | |
# Let's now create a homepage with an pull request | |
cd $DEMO_APP | |
jx create issue -t "add a homepage #1" | |
jx get issues | |
#DO open issue URL | |
#git checkout -b feature-1 | |
git checkout -b wip | |
mkdir src/main/resources/static | |
cat <<< ' | |
<!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>' > src/main/resources/static/index.html | |
#commit and push to origin | |
git add . | |
git commit -m "hp added #1" | |
git push origin wip | |
#create a 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 a webhook a PR a pipeline is automatically triggered for this PR | |
#DO open pull request in web-browser and wait for availability of preview env!! | |
#DO compare it to the output of jx get previews | |
# A preview environment is available for this PR until the PR is merged | |
#DO click on the link in GitHub PR as soon as it shows the preview link | |
jx get build logs # to see the build for the PR | |
#DO wait until build is finished | |
jx get applications # to see that next version is deployed to staging | |
# DO open web browser 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 | |
#jx get applications -e production | |
#jx get applications -e staging | |
cd $DEMO_APP | |
git checkout master | |
jx promote --version 0.0.X --env production -a $DEMO_APP | |
#start a pipeline | |
#jx start pipeline | |
#create env | |
jx create env -n test -l Test --no-gitops --namespace jx-spring-test | |
jx create spring | |
jx create spring -d web -d actuator | |
jx get activity -f $DEMO_APP -w | |
jx get build logs cccaternberg/$DEMO_APP/master | |
jx get pipelines | |
#get clusters | |
kubectl config get-clusters | |
#get urls | |
jx get urls | |
#jx import hellonode | |
#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 | |
#show suported buildpacks (created by running jx create/init) | |
##serverless | |
ls -al ~/.jx/draft/packs/github.com/jenkins-x-buildpacks/jenkins-x-kubernetes/packs | |
#classic | |
ls -al ~/.jx/draft/packs/github.com/jenkins-x-buildpacks/jenkins-x-classic/packs | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment