Closed kenca5ey closed 3 years ago
My mistake, I had configured the variables wrong. Working now!
Im experiencing the same error when build is triggered from branch other than master.
my gitlab-ci.yaml :
build-docker-stg: # staging environment image: docker:stable stage: build services:
docker login -u "$DOCKER_REGISTRY_USER" -p "$DOCKER_REGISTRY_PASSWORD" $DOCKER_REGISTRY_URL # Instructs GitLab to login to its registry
script:
gitlab pipeline gives error:
Positional parameter not supported: registry.gitlab.com/my-user/my-repo:stg ERROR: Job failed: exit code 1
(above, my-user & my-repo are replaces with my private repo and user names)
I am having the same issue. Deploying from master branch works but not from any other branches or tags. I have pretty much the same caprover deploy command (except I am using the deploy token instead of the password).
@tasull Have you found a solution?
@kenca5ey maybe you can share your "variables wrong" problem with us, if it might solve our problem.
EDIT: here is some more discussed issue regarding this topic: https://github.com/caprover/caprover-cli/issues/85
I am having the same issue. Deploying from master branch works but not from any other branches or tags. I have pretty much the same caprover deploy command (except I am using the deploy token instead of the password).
@tasull Have you found a solution?
@kenca5ey maybe you can share your "variables wrong" problem with us, if it might solve our problem.
EDIT: here is some more discussed issue regarding this topic: #85
No, still not resolved
Which line does it fail at?
Same issue When using main it works but in another branch, it does not work!
Error: Positional parameter not supported: registry.gitlab.com....
build-docker-master:
image: docker:latest
stage: build
services:
- docker: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 ./docker/stage/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:
- develop
Can you try adding an echo debug command before docker run:
echo "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"
What does this print?
Following the steps of https://caprover.com/docs/ci-cd-integration.html the following build failure happens in gitlab:
"Positional parameter not supported: registry.gitlab.com/" etc.
I removed the end of the error as it is my personal details. All steps up to that point are successful.
P.S. Caprover is a fantastic project. Keep up the fantastic work.