0

I have a small pipeline to use a custom composer package into a project:

  • the private gitlab project generates a composer package and publish it to the project package registry: this works all fine
  • a second private project use satis to generate a repository with the first project package and publish the resulting build folder to the project gitlab pages: this too wortks fine (all the packages versions are visible from the web ui), the project pages permission is set to 'Only project members'
  • last, the main project uses composer to download my package from the satis repo: here i'm getting the error
    Invalid credentials for 'https://gitlab.com/users/sign_in', aborting.
    

I added an entry in the repositories section of composer.json and added gitlab credentals with composer cli command

composer.json 'repositories' entry

"repositories": [
    {
        "type": "composer",
        "url": "https://gitlab.com/vendor/group/project"
    }
]

composer cli command for credentials

composer config gitlab-token.gitlab.com glpat-123456789abcdefgh

auth.json generated by composer cli

{
    "gitlab-token": {
        "gitlab.com": "glpat-123456789abcdefgh"
    }
}

error during composer require

Invalid credentials for 'https://gitlab.com/users/sign_in', aborting.
fudo
  • 2,254
  • 4
  • 22
  • 44

1 Answers1

0

Ok, i did found a wrong documentation page.

According to Install a Composer package the correct composer cli command to add the repository entry in composer.json is

composer config repositories.<group_id> composer https://gitlab.example.com/api/v4/group/<group_id>/-/packages/composer/

that leads to the entry

"repositories": {
    "<group_id>": {
        "type": "composer",
        "url": "https://gitlab.example.com/api/v4/group/<group_id>/-/packages/composer/"
    },
    ...
},
fudo
  • 2,254
  • 4
  • 22
  • 44