Get the App
SLTechnology News&Howtos  ›  Servers  › 

Rancher pipelined configuration

Shulou Source: shulou.com Published: 2022-06-03 07:40:50 09月21日 Update

1. Pipeline authorization settings

Gitlab version needs to be above 9, the authorized account must be the Maintainer of the project (master in gitlab 8), create the application in gitlab, copy the callbackurl on rancher

Generate the required ID and Key

Fill in the ID and Key just generated, and enter the URL of your gitlab address.

After authorization is complete, set resource limits for pipeline operation

2. Configuration pipeline

Now you can start setting up the pipeline, first set up the code base, open the code base that needs to run

Set what conditions can trigger the pipeline

Start the configuration pipeline process and select the branch you want to configure

3. Pipeline configuration

The first step is that the system has been set up, we only need to set up the following steps according to our own needs

The second step is build, the selected type is run script, execute mvn clean package command, the selected image is my own package maven3.6 image.

The company has its own maven private server, so when packaging maven mirror, you can set the setting.xml file and upload it to the harbor repository configured above. If you don't know where the settings file is placed in the mvn mirror, run mvn -X to see the order in which mvn reads the configuration files, and then copy the settings file into it.

This step is mainly to package the package built with build into an image according to the Dockerfile in the code. The current directory is still the directory after git clone. Specify the relative position of Dockerfile and name the packaged image name, where:${CICD_GIT_COMMIT} in the image name is a variable provided by rancher. Here the Dockerfile path and build context path are the path to the Dockerfile in the gitlab library.

Here is how to configure dockerfile:

FROM registry.hello.com/jdk:1.8_232 #This is my private warehouse jdk mirror ADD ./ target/app.jar app.jarCMD ["java -jar app.jar -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"]

The last step is to deploy the Deployment.yaml file. The yaml path is the path under the project in your gitlab repository.

Once you've saved it, you can see that you're building it.

Once all are running successfully, you can see the pod running status in the workload

Perfect finish!

Tags: Configuration mirroring pipelining pipelining files runs paths code repositories locations directories projects builds selections success up and down context company branches variables Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft MariaDB Shulou Information vpn Apple