Skip to content

devon4net

devonfw-core edited this page Sep 29, 2021 · 3 revisions
400
400

devon4net Template for Production Line

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:

  • ProductionLine instance

  • docker or openshift deployment

  • pushing artifacts to nexus3

Prerequisites

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

500

Next click on the pen icon

500

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

600

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

600

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 guide.

How to run the Template

  • Build the job with parameters:

    • PROJECT_NAME: The project name.

    • PROJECT_SUFFIX: The project name suffix. As your project can have multiple assets (backend, frontend, middleware…​), you can define a suffix in order to identify each one with a different name

    • GROUP_ID: The group id of the project.

    • GITLAB_USER_PRIVATE_TOKEN: Private Token of a Production Line Gitlab User that can be used to create repositories. Created as prerequisite, you only need to add it as credential with GitLab API token Kind.

    • GITLAB_CREATE_GROUP_NAME: Name of the GitLab group. The repository will be create inside this group.

    • GITLAB_CREATE_PROJECT_DESCRIPTION: Description of the repository.

    • 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:

  • A new GitLab repository.

    • The repository group is the value passed in the GITLAB_CREATE_GROUP_NAME parameter.

    • The repository name is PROJECT_NAME-PROJECT_SUFFIX

    • The repository contains a clean devon4net project.

    • The repository contains a Jenkinsfile.

    • The repository has already configured the jenkins webhook.

    • The repository protects the branches master and release/* to only maintainers to push. Develop is the default branch.

  • 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.