Rate This Document
Findability
Accuracy
Completeness
Readability

Installing GitLab Runner

Install GitLab Runner on the worker node. If there are multiple worker nodes, install GitLab Runner on each worker node.

  1. Download the GitLab Runner installation package.
    wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-runner/yum/el7-aarch64/gitlab-runner-16.9.0-1.aarch64.rpm

    Alternatively, you can download the GitLab Runner installation package that matches your environment from https://mirrors.tuna.tsinghua.edu.cn/ or https://gitlab-runner-downloads.s3.amazonaws.com/latest/index.html. The following uses gitlab-runner-16.9.0-1.aarch64.rpm as an example to describe how to manually download the installation package and upload it to the server.

  2. Install the GitLab Runner installation package.
    yum install -y git tar  
    rpm -ivh gitlab-runner-16.9.0-1.aarch64.rpm
  3. Specify gitlab-runner.
    gitlab-runner uninstall 
    mkdir /home/Kunpeng_staff 
    gitlab-runner install --working-directory /home/Kunpeng_staff --user root   

    If you want to specify another user, run the following commands:

    useradd USER  
    gitlab-runner install --working-directory /home/Kunpeng_staff --user USER

    Parameters in the gitlab-runner install command:

    • --working-directory specifies the gitlab-runner service installation directory.
    • --user specifies the user who runs the service.

    In the example, /home/Kunpeng_staff is the gitlab-runner service installation directory and USER is the user name. Replace them with the actual directory and user name.

  4. Start gitlab-runner.

    Reload the configuration.

    systemctl daemon-reload

    Start the service.

    systemctl start gitlab-runner

    Set automatic startup.

    systemctl enable gitlab-runner

    Restart the service.

    systemctl restart gitlab-runner
  5. View gitlab-runner.
    systemctl status gitlab-runner

    If the startup is successful, the information shown in Figure 1 is displayed.

    Figure 1 Starting gitlab-runner
  6. Set the permission.
    chown -R root:root /home/Kunpeng_staff 

    If you want to specify another user, run the following command:

    chown -R USER:USER /home/Kunpeng_staff
  7. Register the GitLab Runner service.
    1. Log in to GitLab, click Runners in the navigation tree on the left, and click Create a new runner on the right panel.
      Figure 2 Creating a runner
    2. Enter tags. If there are multiple tags, separate them with commas (,). The tag can be kunpeng_scanner,kunpeng_c_builder-gcc,kunpeng_java_builder,kunpeng_compatibility. Set other configuration items as required and click Create runner.
      Figure 3 Entering tags
    3. After a runner is created, register it in the GitLab Runner environment based on the URL and token on the page. See Figure 4.
      Figure 4 Registering a runner
    4. Click Go to runners page to view the runner information.
      Figure 5 Going to the runners page
  8. Configure the script. After creating or importing a project, go to the project page, select Build in the directory, and edit the script in the pipeline editor.
    • The following is an example of invoking the BiSheng Compiler:
      stages:           
        - build
      
        clang_job:
         stage: build
         tags:
           - kunpeng_scanner # This is the tag used during gitlab-runner registration. Multiple tags may be selected.
         script:
           - /root/BiShengCompiler-3.2.0-aarch64-linux/bin/clang /opt/test.c -o Output_path # The BiSheng Compiler has been installed on the host. Enter the actual path.

      In the pipeline script, when a step requires invoking the BiSheng Compiler for compilation, the file /opt/test.c is used as an example target.

    • The following is an example of invoking GCC for openEuler:
      stages:
        - build
      
        gcc_job:
         stage: build
         tags:
           - kunpeng_scanner # This is the tag used during gitlab-runner registration. Multiple tags may be selected.
         script:     - /root/gcc-10.3.1-2023.12-aarch64-linux/bin/gcc /opt/test.c -o Output_path # GCC for openEuler has been installed on the host. Enter the actual path.

      In the pipeline script, when a step requires invoking GCC for openEuler for compilation, the file /opt/test.c is used as an example target.