Gitlab CI :- Getting pending status after push on the gitlab

前端 未结 1 386
甜味超标
甜味超标 2021-01-26 09:04

I am using the Gitlab-ci for the creating the build on the push,I have also creating the .gitlab-ci.yml inside my root directory. With

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-26 09:39

    If you have active shared-runner, then try to give the tags of the runner in the .gitlab-ci.yml. Say if the tag for the shared-runner is dev-ci, then find below the updated code:

    image: jangrewe/gitlab-ci-android
    
    stages:
      - build
    
    before_script:
      - export GRADLE_USER_HOME=$(pwd)/.gradle
      - chmod +x ./gradlew
    
    cache:
      key: ${CI_PROJECT_ID}
      paths:
        - .gradle/
    
    build:
      stage: build
      tags:
      - dev-ci
      script:
        - ./gradlew assembleDebug
      artifacts:
        paths:
          - app/build/outputs/
    

    Screenshot of the runner tags:

    Setting up a runner

    Before setting up a runner for your project, you need to first:

    1. Install gitlab-runner on a server separate than where GitLab is installed.
    2. Register a runner [there are 3 types of runners: shared, group and specific runners. Depending on requirement, you can choose which runner to register.]
    3. While registering the runner, you need to give tags and the type of runner executor you need.
    4. After registering the runner, go to Project >> Settings >> CI/CD >> Runners, you can see the runner is online. If in case you are using Group or Shared runner, then you need to enable the runner in Project settings.

    In your case, you can use Specific Runner with Docker as Runner-Executor and then, in the .gitlab-ci.yml use the tags you provided while registering the runner.

    0 讨论(0)
提交回复
热议问题