Commit 8fde1039 authored by Boris Barnier's avatar Boris Barnier Committed by Pierre Smeyers
Browse files

feat: use base Alpine image for better overridability

parent 2b25cf02
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ include:

variables:
  BASH_SHELLCHECK_FILES: "*.sh"
  GITLAB_SYNC_IMAGE: "registry.hub.docker.com/library/alpine:latest"

stages:
  - build
@@ -12,7 +13,7 @@ stages:

sync-tbc:
  image:
    name: "registry.hub.docker.com/dwdraju/alpine-curl-jq:latest"
    name: "${GITLAB_SYNC_IMAGE}"
    entrypoint: [""]
  stage: build
  variables:
@@ -35,9 +36,10 @@ sync-tbc:
          echo -e "CA certificates imported in \\e[33;1m/etc/ssl/cert.pem\\e[0m"
        fi
      }
    - apk update
    - apk upgrade
    - apk add --no-cache git
    - install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}"
    - apk add --update --no-cache git curl jq bash
    # done twice because /etc/ssl/certs/ca-certificates.crt is altered during apk add
    # we can't use update-ca-certificates --fresh because $CUSTOM_CA_CERTS can contains several certificates
    - install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}"
  script:
    - bash ${CI_DEBUG_TRACE+-x} ./gitlab-sync.sh
@@ -49,3 +51,12 @@ sync-tbc:
    - if: '$CI_PIPELINE_SOURCE == "web"'
    # allow scheduled source
    - if: '$CI_PIPELINE_SOURCE == "schedule"'

sync-tbc-dryrun:
  extends: sync-tbc
  script:
    # unset dest GitLab (dryrun)
    - bash ${CI_DEBUG_TRACE+-x} ./gitlab-sync.sh --dest-api ""
  rules:
    # run only on gitlab.com (to test at least the script correctly crawls tbc projects)
    - if: '$CI_SERVER_HOST == "gitlab.com"'
+2 −0
Original line number Diff line number Diff line
@@ -54,3 +54,5 @@ curl -s https://gitlab.com/to-be-continuous/tools/gitlab-sync/-/raw/master/gitla
Once copied _to be continuous_ to your GitLab server, you shall then schedule a pipeline in this project (`to-be-continuous/tools/gitlab-sync`) - for instance every night - to keep synchronized with source project.

The script will only require a GitLab token, that shall be configured declaring a `$GITLAB_TOKEN` CI/CD project variable. (`--dest-api` will be implicitly retrieved using predefined `$CI_API_V4_URL`).

You can define a custom alpine image to use by setting `$GITLAB_SYNC_IMAGE` (default to `registry.hub.docker.com/alpine:latest`)
 No newline at end of file