mehrancodes/laravel-harbor

Setup with Gitlab advice

Opened this issue · 1 comments

For anyone else searching for how to setup Harbor on Gitlab CI this should be useful.
(Based on a pipeline initiated from the merge request context and having Gitlab setup as a Git provider in Forge)

harbor-provision-staging-site:
  stage: deploy
  variables:
    FORGE_TOKEN: XXXXX
    FORGE_SERVER: XXXXX
    FORGE_GIT_PROVIDER: gitlab # <-- This is critical and not documented currently
    FORGE_GIT_REPOSITORY: $CI_MERGE_REQUEST_PROJECT_PATH
    FORGE_GIT_BRANCH: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
    FORGE_DOMAIN: XXXXX
    FORGE_DEPLOY_SCRIPT: "git pull origin $$FORGE_SITE_BRANCH;"
  dependencies: []
  rules:
    - if: $CI_MERGE_REQUEST_PROJECT_PATH != '' # ensures the job only runs in merge request context
      when: manual
  image: kirschbaumdevelopment/laravel-test-runner:8.1
  script:
    # Install Harbor via Composer
    - composer global require mehrancodes/laravel-harbor -q
    # Start Provisioning
    - harbor provision

Note: the escaped variables with double dollar symbols in the the FORGE_DEPLOY_SCRIPT

Thanks a bunch for giving it a go with GitLab! I'll make sure to include FORGE_GIT_PROVIDER in the docs soon.

Having this example documented would be super helpful for folks looking to use Harbor with GitLab. I take care of it soon. Appreciate your help!