Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: undefined TypeError: Cannot read properties of undefined (reading 'split') #33

Open
Dextererials opened this issue May 7, 2023 · 1 comment

Comments

@Dextererials
Copy link

I am getting an error message undefined TypeError: Cannot read properties of undefined (reading 'split') when I try to add the plugin semantic-release-docker-gitlab-ci. The error is getting thrown from semantic-release-docker-gitlab-ci/src/verify.js:35:1 Not sure what I am doing wrong. Here is my config files:

stages:
  - build
  - release

# Build docker image
build:
  image: docker:20.10
  stage: build
  dependencies:
    - setup-netrc
  services:
    - docker:23-dind
  before_script:
    - echo -n $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
  script:
    - docker build --secret id=netrc,src=netrc/.netrc --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA

# Run Release
semantic-release:
  image: node:lts
  stage: release
  variables:
    GITLAB_TOKEN: ${GITLAB_ACCESS_TOKEN}
  before_script:
    - apt-get update
    - npm install semantic-release @semantic-release/gitlab @semantic-release/release-notes-generator @semantic-release/commit-analyzer semantic-release-docker-gitlab-ci
  script:
    - npx semantic-release
@casparbauer
Copy link

I have just been able to reproduce this. It relates to the project name (or groups) including uppercase letters. While the gitlab repository path can contain uppercase letters (eg. [email protected]/group/Foo-Service), the gitlab registry can not (the equivalent created by gitlab will be registry.gitlab.com/group/foo-service). https://github.com/kaibloecker/semantic-release-docker-gitlab-ci/blob/main/src/auth.js#L34 does not take this into account (PROJECT_PATH needs to be .toLowerCase()'ed).

@Dextererials as a manual workaround: You have to ensure that the repository path is lower case. You sadly can not just change the path, since gitlab considers the underlying registry path as already taken. Therefore you have the change the repository path twice: Eg. first to gitlab.com/group/foo-service-2 and then to gitlab.com/group/foo-service

@kaibloecker would you accept a patch that lower cases PROJECT_PATH?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants