{"id":824,"date":"2020-03-30T10:00:00","date_gmt":"2020-03-30T10:00:00","guid":{"rendered":"http:\/\/bullyrooks.com\/index.php\/2020\/04\/02\/simple-spring-boot-service-to-kubernetes-application-step-10-e1a3a8e865bb\/"},"modified":"2021-02-04T01:55:15","modified_gmt":"2021-02-04T01:55:15","slug":"simple-spring-boot-service-to-kubernetes-application-step-10-e1a3a8e865bb","status":"publish","type":"post","link":"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-10-e1a3a8e865bb\/","title":{"rendered":"Automated Build Pipeline"},"content":{"rendered":"\n<p class=\"graf graf--p graf-after--h3 graf--trailing\" id=\"b55b\">Lets set up automated build so that we can generate a docker image when a change hits master.<\/p>\n\n\n\n<h3 class=\"graf graf--h3 graf--leading wp-block-heading\" id=\"8d0e\">Build the&nbsp;Pipeline<\/h3>\n\n\n\n<p class=\"graf graf--p graf-after--h3\" id=\"39d0\">Go in to codefresh and choose Projects. Create a new project in the top right. Call it <code class=\"markup--code markup--p-code\">medium<\/code>. Click on create pipeline. Call the pipeline medium-customer and choose our git repository from github. In the pipeline editor, add this yaml:<\/p>\n\n\n\n<pre id=\"f2d1\" class=\"wp-block-code graf graf--pre graf-after--p\"><code># More examples of Codefresh YAML can be found at\n# <a class=\"markup--anchor markup--pre-anchor\" href=\"https:\/\/codefresh.io\/docs\/docs\/yaml-examples\/examples\/\" target=\"_blank\" rel=\"nofollow noopener\" data-href=\"https:\/\/codefresh.io\/docs\/docs\/yaml-examples\/examples\/\">https:\/\/codefresh.io\/docs\/docs\/yaml-examples\/examples\/<\/a><\/code><\/pre>\n\n\n\n<pre id=\"e6b8\" class=\"wp-block-code graf graf--pre graf-after--pre\"><code>version: \"1.0\"\n# Stages can help you organize your steps in stages\nstages:\n  - \"clone\"\n  - \"build\"\n  - \"push\"<\/code><\/pre>\n\n\n\n<pre id=\"b971\" class=\"wp-block-code graf graf--pre graf-after--pre\"><code>steps:\n  Clone:\n      title: \"Cloning repository\"\n      type: \"git-clone\"\n      repo: \"<a class=\"markup--anchor markup--pre-anchor\" href=\"https:\/\/github.com\/brianrook\/medium-customer\" target=\"_blank\" rel=\"nofollow noopener\" data-href=\"https:\/\/github.com\/brianrook\/medium-customer\">https:\/\/github.com\/brianrook\/medium-customer<\/a>\"\n      revision: \"master\"\n      stage: \"clone\"\n  PrintFileList:\n      title: 'Listing files'\n      stage: \"clone\"\n      image: alpine:latest\n      commands:\n          - 'ls -l'\n  BuildJar:\n      title: Create Jar\n      stage: \"build\"\n      image: 'maven:3.6.3-jdk-11'\n      commands:\n        - mvn -Dmaven.repo.local=\/codefresh\/volume\/m2_repository clean package\n      working_directory: '\/codefresh\/volume\/medium-customer'\n  BuildImage:\n      title: Building Docker Image\n      type: build\n      stage: build\n      image_name: medium\/medium-customer\n      working_directory: '\/codefresh\/volume\/medium-customer'\n      tag: '${{CF_SHORT_REVISION}}'\n      dockerfile: Dockerfile\n  PushToCodeFresh:\n      type: push\n      stage: \"push\"\n      title: Push to Remote Repository\n      candidate: ${{BuildImage}}\n      tag: '${{CF_SHORT_REVISION}}'\n      image_name: medium-customer\n      registry: cfcr\n      fail_fast: false<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote graf graf--blockquote graf-after--pre is-layout-flow wp-block-quote-is-layout-flow\" id=\"c3bb\"><p>We\u2019re telling the build pipeline to clone our repo, use maven to build the jar and then execute docker build (like we did in the last section) to package the jar into an image. We then push that image to codefresh\u2019s docker image registry.<\/p><\/blockquote>\n\n\n\n<p class=\"graf graf--p graf-after--blockquote graf--trailing\" id=\"e265\">Go ahead and run it and make sure that it builds an image correctly. We can view the docker image registry via the browser to confirm the build.<\/p>\n\n\n\n<h3 class=\"graf graf--h3 graf--leading wp-block-heading\" id=\"d604\">Hooking it into Our Master&nbsp;Commit<\/h3>\n\n\n\n<p class=\"graf graf--p graf-after--h3\" id=\"4451\">We should have a trigger already set. Click on triggers on the right bar and confirm that a trigger for github exists. You can view it with the pencil. It should be listening for push commits. We can test that by making a commit to any of our branches.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"entry-summary\">\nLets set up automated build so that we can generate a docker&hellip;\n<\/div>\n<div class=\"link-more\"><a href=\"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-10-e1a3a8e865bb\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &ldquo;Automated Build Pipeline&rdquo;<\/span>&hellip;<\/a><\/div>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[78,77,76,29,44],"course":[40],"class_list":["post-824","post","type-post","status-publish","format-standard","hentry","category-software-development","tag-automation","tag-cicd","tag-codefresh","tag-git","tag-github","course-spring-with-kubernetes","entry"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":833,"url":"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-18-9dff659cd334\/","url_meta":{"origin":824,"position":0},"title":"UI Build Pipeline","author":"Bullyrook","date":"March 30, 2020","format":false,"excerpt":"Simple Spring Boot Service to Kubernetes Application: Step\u00a018 Lets quickly update our build pipeline to push an image for our front end application into our repo. This opens the path to using helm to package and deploy our chart. Create a New\u00a0Pipeline Log into codefresh and go into pipelines. Choose\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":823,"url":"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-21-6986a29db37a\/","url_meta":{"origin":824,"position":1},"title":"Simplify Deployment","author":"Bullyrook","date":"March 30, 2020","format":false,"excerpt":"Now that we have multiple components lets simplify our deployment so that we can deploy our complete application in one step. Create an Umbrella\u00a0Chart Create a new git repository called medium-application. This is the repository that will house the helm umbrella chart. Create a directory called helm and run helm\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":817,"url":"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-20-fe28a586cdc6\/","url_meta":{"origin":824,"position":2},"title":"Creating an Ingress in Kubernetes","author":"Bullyrook","date":"March 30, 2020","format":false,"excerpt":"We\u2019ve got multiple service available for deployment now. Lets allow them to communicate internally and externally with the cluster. We\u2019ll do that by creating an ingress. Current State of Our Application We\u2019re using our services as nodeports which allows us to expose an external port that will map to the\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":818,"url":"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-19-944a76415384\/","url_meta":{"origin":824,"position":3},"title":"Put the UI in to Helm","author":"Bullyrook","date":"March 30, 2020","format":false,"excerpt":"Lets take the docker image we just created and wrap it with helm so that we have an easy way to deploy our application. Create Helm Chart Templates We\u2019ve created helm charts before, so lets create a helm directory at the frontend root. Then run helm create in that directory\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":822,"url":"https:\/\/bullyrooks.com\/index.php\/2020\/03\/30\/simple-spring-boot-service-to-kubernetes-application-step-13-c3d437bb7570\/","url_meta":{"origin":824,"position":4},"title":"Automating Deployment (for CICD)","author":"Bullyrook","date":"March 30, 2020","format":false,"excerpt":"Now that we\u2019ve deployed our application, lets reduce some of the manual steps and make our deployments more reproducible with the intent of eventually making them automated for CI\/CD. Publish our Chart to the Chart Repository Normally, we would need to create a helm chart repository, however, codefresh has given\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1161,"url":"https:\/\/bullyrooks.com\/index.php\/2022\/01\/02\/cloud-kube-build-pipeline-initialization\/","url_meta":{"origin":824,"position":5},"title":"Cloud Kube | Build Pipeline Initialization","author":"Bullyrook","date":"January 2, 2022","format":false,"excerpt":"Now that we have a service we're going to start building our pipeline so that as we add functionality to the application we can incorporate any build needs into the pipeline. Initialize Github Actions Create a new directory from the root of the project called .github\/workflows\/ create a file called\u2026","rel":"","context":"In &quot;Software Development&quot;","block_context":{"text":"Software Development","link":"https:\/\/bullyrooks.com\/index.php\/category\/software-development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-16.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-16.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-16.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-16.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/bullyrooks.com\/wp-content\/uploads\/2022\/01\/image-16.png?resize=1400%2C800&ssl=1 4x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts\/824","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/comments?post=824"}],"version-history":[{"count":3,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts\/824\/revisions"}],"predecessor-version":[{"id":895,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/posts\/824\/revisions\/895"}],"wp:attachment":[{"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/media?parent=824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/categories?post=824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/tags?post=824"},{"taxonomy":"course","embeddable":true,"href":"https:\/\/bullyrooks.com\/index.php\/wp-json\/wp\/v2\/course?post=824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}