Creating a Jenkins pipeline using JHipster

We can create Jenkinsfile for our project using the ci-cd sub-generator from JHipster:

  1. In a Terminal, navigate to the online-store folder first. Now run the following command:
> jhipster ci-cd
  1. You will be asked to select from a list of options, as follows:
Welcome to the JHipster CI/CD Sub-Generator
? What CI/CD pipeline do you want to generate? (Press <space> to select, <a> to toggle all, <i> to inverse selection)
>Jenkins pipeline
◯ Azure Pipelines
◯ Travis CI
◯ GitHub CI

◯ GitLab CI
  1. Let's select Jenkins pipeline from it. Next, we can choose to run the build inside a Docker container. Let's choose No here:
Welcome to the JHipster CI/CD Sub-Generator
? What CI/CD pipeline do you want to generate? Jenkins pipeline
? Would you like to perform the build in a Docker container ? (y/N)
  1. The next question will be about sending build status to GitLab—choose No for that as well:
? What CI/CD pipeline do you want to generate? Jenkins pipeline
? Would you like to perform the build in a Docker container ? No
? Would you like to send build status to GitLab ? No

  1. Next, we will have an option to choose additional stages. Let's choose the Deploy to *Heroku* option here to automatically deploy to Heroku from our CI/CD pipeline:
? What CI/CD pipeline do you want to generate? Jenkins pipeline
? Would you like to perform the build in a Docker container ? No
? Would you like to send build status to GitLab ? No
? What tasks/integrations do you want to include ? (Press <space> to select, <a> to
toggle all, <i> to invert selection)
>◯ Deploy your application to an *Artifactory*
◯ Analyze your code with *Sonar*
◯ Build and publish a *Docker* image
◯ Deploy to *Heroku* (requires HEROKU_API_KEY set on CI service)
  1. Let's provide a name to deploy; we can change it later if required:
? What CI/CD pipeline do you want to generate? Jenkins pipeline
? Would you like to perform the build in a Docker container ? No
? Would you like to send build status to GitLab ? No
? What tasks/integrations do you want to include ? Deploy to
*Heroku*
? *Heroku*: name of your Heroku Application ? store

Once the options are selected, JHipster will generate the files and log the following output on the console:

   create Jenkinsfile
create src/main/docker/jenkins.yml
create src/main/resources/idea.gdsl
Congratulations, JHipster execution is complete!
If you want to use Travis instead of Jenkins, you can do so by choosing the Travis option and then publishing the repository to GitHub as a public repository. Once published, go to https://github.com/<username>/<repoName>/settings/installations, add Travis CI as a service, and follow the instructions. You can now see automated builds when you make commits. Refer to https://docs.travis-ci.com/user/getting-started/ for details.

As you can see, we got Jenkinsfile generated at the root and a Docker image for Jenkins created in the src/main/docker directory. We also got an idea.gdsl file, which is used by IntelliJ IDEA for autocompletion.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.213.209