caprover / caprover-cli

Command Line Interface for https://github.com/caprover/caprover
72 stars 40 forks source link

GitLab CI/CD Issue #123

Open synetalsolutions opened 2 years ago

synetalsolutions commented 2 years ago

It was working till yesterday now showing this issues when I try to run pipline.

Positional parameter not supported: registry.gitlab.com/xxx/xxxi/my-build-image:b14d966dd96557cbd0a8dddeeac7568e382d4216 Cleaning up project directory and file based variables ERROR: Job failed: exit code 1

for .gitlab.yml I am using office document of caprover but still this issues comming.

`build-docker-master:
  image: docker:19.03.1
  stage: build
  services:
    - docker:19.03.1-dind
  before_script:
    - export DOCKER_REGISTRY_USER=$CI_REGISTRY_USER # built-in GitLab Registry User
    - export DOCKER_REGISTRY_PASSWORD=$CI_REGISTRY_PASSWORD # built-in GitLab Registry Password
    - export DOCKER_REGISTRY_URL=$CI_REGISTRY # built-in GitLab Registry URL
    - export COMMIT_HASH=$CI_COMMIT_SHA # Your current commit sha
    - export IMAGE_NAME_WITH_REGISTRY_PREFIX=$CI_REGISTRY_IMAGE # Your repository prefixed with GitLab Registry URL
    - docker login -u "$DOCKER_REGISTRY_USER" -p "$DOCKER_REGISTRY_PASSWORD" $DOCKER_REGISTRY_URL # Instructs GitLab to login to its registry

  script:
    - echo "Building..." # MAKE SURE NO SPACE ON EITHER SIDE OF = IN THE FOLLOWING LINE
    - export CONTAINER_FULL_IMAGE_NAME_WITH_TAG=$IMAGE_NAME_WITH_REGISTRY_PREFIX/my-build-image:$COMMIT_HASH
    - docker build -f ./Dockerfile --pull -t built-image-name .
    - docker tag built-image-name "$CONTAINER_FULL_IMAGE_NAME_WITH_TAG"
    - docker push "$CONTAINER_FULL_IMAGE_NAME_WITH_TAG"
    - echo $CONTAINER_FULL_IMAGE_NAME_WITH_TAG
    - echo "Deploying on CapRover..."
    - docker run caprover/cli-caprover:v2.1.1 caprover deploy --caproverUrl $CAPROVER_URL --caproverPassword $CAPROVER_PASSWORD --caproverApp $CAPROVER_APP --imageName $CONTAINER_FULL_IMAGE_NAME_WITH_TAG
  only:
    - master`

I have passed all the variable on the gitlab.

githubsaturn commented 2 years ago

This is a Gitlab issue. Many potential reasons behind it, see this for example: https://github.com/caprover/caprover-cli/issues/85#issuecomment-899030595

synetalsolutions commented 2 years ago

I got the solutions those who have protected variable and the repository is not protected then it will create this kind of issue if you need to either make repository protected or variable unprotected.

After uncheck on variables its working properly.