Skip to content

Positional parameter not supported: test #85

Closed

Description

@dankore

test is the name of my Caprover app

Dockerfile:

FROM node:14-alpine

RUN apk update && apk upgrade && \
    apk add --no-cache git
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY ./package.json /usr/src/app/
RUN npm install --production && npm cache clean --force
COPY ./ /usr/src/app


ENV NODE_ENV production
ENV PORT 80
EXPOSE 80

RUN npm run build

CMD [ "npm", "start" ]

.gitlab-ci.yml

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

image

Activity

  1. githubsaturn commented on Feb 9, 2021

    @githubsaturn
    Collaborator

    You probably have a space somewhere in your vars. Double check:
    CAPROVER_URL , CAPROVER_PASSWORD , CAPROVER_APP

  2. dankore commented on Feb 9, 2021

    @dankore
    Author

    @githubsaturn, thank you.

    I had CAPROVER_PASS instead of CAPROVER_PASSWORD.

    Worked like a charm!

  3. dankore commented on Feb 9, 2021

    @dankore
    Author

    Now i'm having this error:

    Error: (HTTP code 500) server error - Head https://registry.gitlab.com/v2/ds-templates/nextjs-mongodb/my-build-image/manifests/dfcde68d6519503c19793b9f102d9de8160c2aff: denied: access forbidden

    {"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"repository","Class":"","Name":"ds-templates/nextjs-mongodb/my-build-image","Action":"pull"}]}]}

    image

    Any help would be greatly appreciated!

  4. githubsaturn commented on Feb 9, 2021

    @githubsaturn
    Collaborator
  5. dankore commented on Feb 9, 2021

    @dankore
    Author

    Make sure you follow steps 4 and 5 here: https://caprover.com/docs/ci-cd-integration.html#4--create-an-access-token-for-caprover

    I did. In fact, I created another access token. The previous one was never used.

    But also, the CI/CD won't run if I don't enable the shared runners or register mine. No mention of that in the tutorial link you shared. Maybe I missed something?

  6. githubsaturn commented on Feb 9, 2021

    @githubsaturn
    Collaborator

    The tutorial is for an individual account. Shared runners are for orgs and group I imagine (?)

    There is also another similar issue here: #84
    They ended up creating a new account and it worked... Now they are trying to find out what is the difference between the old and new account that caused the old account to break.

  7. dankore commented on Feb 9, 2021

    @dankore
    Author

    I confirmed your suspicion @githubsaturn, I was getting 500 HTTPS server error because the repo belonged in a group in Gitlab.

    I created a new project (repo) that does not belong to a group and it worked!

    Same solution for issue #84

    If anyone has a solution for a grouped projects please post.

  8. githubsaturn commented on Feb 9, 2021

    @githubsaturn
    Collaborator

    You can follow up with gilab folks on what the difference is between group and individual projects. But from CapRover side, there is no distinction as long as you define the image prefix and username correctly.

  9. genox commented on Aug 15, 2021

    @genox

    Just as an FYI in case someone ends up here via google:

    I ran into this error on GitLab CI/CD due to the fact that Group variables are, by default, set to be only available in protected branches. "master" is protected by default, which is why every other branch will cause failed build since group env vars are empty. You can make group variables available in unprotected branches:

    Screenshot 2021-08-15 at 12 37 55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions