Skip to content

Commit

Permalink
Added from existing template and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dario-rodriguez committed Mar 17, 2020
1 parent 94e85b4 commit d0689d7
Show file tree
Hide file tree
Showing 11 changed files with 469 additions and 39 deletions.
34 changes: 0 additions & 34 deletions devon4j-mts/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,6 @@ pipeline {
jobDsl scriptText: """
pipelineJob("${params.JENKINS_FOLDER}/MyThaiStar_FRONTEND_DEPLOY") {
description('Deploy job for MyThaiStar Frontend Only.')
parameters {
credentialsParam('registryCredentialsId') {
type('com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl')
required()
defaultValue('nexus-api')
description('registry credentials')
}
stringParam('registryUrl', 'REPLACE_ME', 'docker registry url')
stringParam('VERSION', '3.2.0', 'Version number')
stringParam('dockerNetwork', 'my-thai-star', 'The docker network for the deployed container')
}
definition {
cpsScm {
scm {
Expand All @@ -221,17 +210,6 @@ pipeline {
jobDsl scriptText: """
pipelineJob("${params.JENKINS_FOLDER}/MyThaiStar_SERVER_DEPLOY") {
description('Deploy job for MyThaiStar Backend only.')
parameters {
credentialsParam('registryCredentialsId') {
type('com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl')
required()
defaultValue('nexus-api')
description('registry credentials')
}
stringParam('registryUrl', 'REPLACE_ME', 'docker registry url')
stringParam('VERSION', '3.2.0', 'Version number')
stringParam('dockerNetwork', 'my-thai-star', 'The docker network for the deployed container')
}
definition {
cpsScm {
scm {
Expand All @@ -255,18 +233,6 @@ pipeline {
jobDsl scriptText: """
pipelineJob("${params.JENKINS_FOLDER}/MyThaiStar_REVERSE-PROXY_DEPLOY") {
description('Deployment Pipeline for both Frontend and Backend at the same time.')
parameters {
credentialsParam('registryCredentialsId') {
type('com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl')
required()
defaultValue('nexus-api')
description('registry credentials')
}
booleanParam('buildReverseProxy', false, 'Build again the reverse proxy image?')
stringParam('registryUrl', 'REPLACE_ME', 'docker registry url')
stringParam('VERSION', '3.2.0', 'Version number')
stringParam('dockerNetwork', 'my-thai-star', 'The docker network for the deployed container')
}
definition {
cpsScm {
scm {
Expand Down
2 changes: 2 additions & 0 deletions documentation/Home.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ This repository contains a collection of templates that can be used inside a Pro
- link:how-to-add-a-template.asciidoc[How to add a Template to your PL instance]
- link:devon4j-pl.asciidoc[devon4j Template]
- link:devon4ng-pl.asciidoc[devon4ng Template]
- link:devon4net-pl.asciidoc[devon4net Template]
- link:devon4node-pl.asciidoc[devon4node Template]
- link:from-existing-devonfw.asciidoc[From existing devonfw Template]

== Utility Templates

Expand Down
2 changes: 2 additions & 0 deletions documentation/_Sidebar.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
*** link:how-to-add-a-template.asciidoc[How to add a Template to your PL instance]
*** link:devon4j-pl.asciidoc[devon4j Template]
*** link:devon4ng-pl.asciidoc[devon4ng Template]
*** link:devon4net-pl.asciidoc[devon4net Template]
*** link:devon4node-pl.asciidoc[devon4node Template]
*** link:from-existing-devonfw.asciidoc[From existing devonfw Template]
** Utility Templates
*** link:inialize-instance.asciidoc[Initialize Instance Template]
*** link:install-sonar-plugin.asciidoc[Install SonarQube Plugin Template]
Expand Down
2 changes: 1 addition & 1 deletion documentation/devon4j-mts.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ toc::[]

Please read all of the following sections carefully.

=== Overview
== Overview

This template will configure your PL instance to have a 'ready to use' My-Thai-Star devonfw application. It is only an example. In order to start a new project, please use the other templates. This includes:

Expand Down
2 changes: 1 addition & 1 deletion documentation/devon4j-pl.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ image::images/devon4j-pl/devonfw.png[400,300]

= devon4j Template for Production Line

=== Overview
== Overview

This template will configure your PL instance to have a 'ready to use' devon4j template. It can be used as a starting point for your Java projects. +
This includes CICD files for a devonfw technology stack with configuration for:
Expand Down
2 changes: 1 addition & 1 deletion documentation/devon4net.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ image::images/devon4node-pl/devonfw.png[400,300]

= devon4net Template for Production Line

=== Overview
== Overview

This template will configure your PL instance to have a 'ready to use' devon4net template. It can be used as a starting point for your .NET projects. +
This includes CICD files for a devonfw technology stack with configuration for:
Expand Down
2 changes: 1 addition & 1 deletion documentation/devon4ng-pl.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ image::images/devon4ng-pl/devonfw.png[400,300]

= devon4ng Template for Production Line

=== Overview
== Overview

This template will configure your PL instance to have a 'ready to use' devon4ng template. It can be used as a starting point for your Angular projects. +
This includes CICD files for a devonfw technology stack with configuration for:
Expand Down
2 changes: 1 addition & 1 deletion documentation/devon4node-pl.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ image::images/devon4node-pl/devonfw.png[400,300]

= devon4node Template for Production Line

=== Overview
== Overview

This template will configure your PL instance to have a 'ready to use' devon4node template. It can be used as a starting point for your Node projects. +
This includes CICD files for a devonfw technology stack with configuration for:
Expand Down
86 changes: 86 additions & 0 deletions documentation/from-existing-devonfw.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
:toc: macro

ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
:important-caption: :heavy_exclamation_mark:
:caution-caption: :fire:
:warning-caption: :warning:
endif::[]

toc::[]
:idprefix:
:idseparator: -
:reproducible:
:source-highlighter: rouge
:listing-caption: Listing

image::images/devon4node-pl/pl.png[400,300]
image::images/devon4node-pl/devonfw.png[400,300]

= From existing devonfw Template for Production Line

== Overview

From existing devonfw template is very similar to devon4j, devon4ng, devon4net and devon4node templates. The main difference is from existing devonfw template will no create a new devonfw project, it takes an existing project from GitLab and then add/create everything in order to apply a CICD strategy to your project.

== Prerequisites
To be able to run Jenkins Node job under ProductionLine you need to configure below settings in Jenkins and Gitlab

* Jenkins +
** Execute the link:./initialize-instance.asciidoc[initialize instance template]
** If you plan to deploy into OpenShift, you need to execute link:./openshift-configuration.asciidoc[openshift-configuration] template also.
* Gitlab +
** Create a project and upload your current code. In order to start a new project in your local machine, you can use the link:https://github.com/devonfw/ide[devonfw-ide]. The project must be a devon4j, devon4ng, devon4net or devon4node project.
** Generate User Private Token +
Go to your Profile in Gitlab +

image::./images/devon4node-pl/profile.png[500,400]

Next click on the pen icon +

image::./images/devon4node-pl/pen.png[500,400]

On the left menu choose Access Tokens and put token name and check fields like below +

image::./images/devon4node-pl/token.JPG[600,500]

Click "Create personal access token", you should receive notification about created token and token string. Copy the token string.

image::./images/devon4node-pl/created_token.JPG[600,500]

The GitLab API user needs to have API access and the rights to create a new group. To set this permission follow the next steps: +

* Enter the Admin control panel
* Select 'Users'
* Select the user(s) in question and click 'Edit'
* Scroll down to 'Access' and un-tick 'Can Create Group'

== How to insert the Template

In order to add the template, you can follow the link:./how-to-add-a-template.asciidoc[guide].


== How to run the Template

* Build the job with parameters:
** REPOSITORY_URL: The internal repository URL. Without protocol. Example: gitlab-core:80/gitlab/mygroup/myproject-frontend.
** GIT_BRANCH: The branch where you want to apply the CICD changes.
** MERGE_STRATEGY: Choose the merge strategy for cicdgen. For more information see the link:https://github.com/devonfw/cicdgen/wiki/merge-strategies[CICDGEN merge documentation page]
** GITLAB_USER_PRIVATE_TOKEN: Private Token of a Production Line Gitlab User that can be used to create/update repositories. The token proprietary user must have admin rights in the repository. Created as prerequisite, you only need to add it as credential with GitLab API token *Kind*.
** DEPLOY: Choose the environment where you want to deploy. The deployment could be *none*, *docker* or *openshift*. If *docker* or *openshift* were selected, extra parameters will be required in their dedicated steps:
*** Configuring DOCKER:
**** DOCKER_URL: The remote docker daemon URL
**** DOCKER_CERT: Credentials to access docker daemon. If the daemon is not secure, you can leave this empty.
*** Configuring Openshift:
**** OC_NAME: Openshift cluster name. It was defined in the Openshift Configuration template
**** DOCKER_REGISTRY_CREDENTIALS: Nexus docker registry user credentials. It was created in the initialize instance pipeline. The default username is nexus-api, the default password is the same as your service account.

After executing this template, you will have:

* Your GitLab project updated.
** Added a Jenkinsfile with all CICD stages.
** The repository is updated in order to have the jenkins webhook.
* A new multibranch pipeline in jenkins inside the folder _PROJECT_NAME_ with the name _PROJECT_NAME_-_PROJECT_SUFFIX_. As the webhook is already configured, it should be executed on every push to GitLab repository.
* If you choose docker for deployment, your Jenkinsfile should contain two extra stages in order to build and deploy the docker image. Also, the repository should contain the Dockerfiles to create the docker images.
* If you choose OpenShift for deployment, three new applications should be created in your OpenShift. Those applications represent three environments of your application: develop, uat and stage. Also, your Jenkinsfile should contain three extra stages in order to build and deploy the docker image and check that the pod is running without errors. Also, the repository should contain the Dockerfiles to create the docker images.
4 changes: 4 additions & 0 deletions documentation/master-production-line.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ include::devon4j-pl[leveloffset=2]

include::devon4ng-pl[leveloffset=2]

include::devon4net-pl[leveloffset=2]

include::devon4node-pl[leveloffset=2]

include::from-existing-devonfw[leveloffset=2]

== Utility Templates

include::initialize-instance[leveloffset=2]
Expand Down
Loading

0 comments on commit d0689d7

Please sign in to comment.