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

400 Error on publish:gitlab action to private gitlab instance #13741

Closed
bb-k8 opened this issue Sep 19, 2022 · 3 comments
Closed

400 Error on publish:gitlab action to private gitlab instance #13741

bb-k8 opened this issue Sep 19, 2022 · 3 comments
Assignees
Labels

Comments

@bb-k8
Copy link

bb-k8 commented Sep 19, 2022

Running into an error when trying to publish a template to a private gitlab server. The template is the default template provided with create-backstag-app. I've edited the publish action to publish to gitlab.

Relevant configs...

app-config.yml

integrations:
  gitlab:
    - host: MY_HOST
      token: MY_TOKEN
      apiBaseUrl: https://MY_HOST/api/v4
...
scaffolder:
  gitlab:
    visibility: private

template.yml

spec:
  steps:
    ...
    - id: publish
      name: Publish
      action: publish:gitlab
      input:
        allowedHosts: ['MY_HOST']
        token: MY_TOKEN
        description: This is ${{ parameters.name }}
        repoUrl: ${{ parameters.repoUrl }}

And the error message:

[1](http://localhost:3000/...) TIMESTAMP Beginning step Publish
[2](http://localhost:3000/...) TIMESTAMP HTTPError: Response code 400 (Bad Request)
    [3](http://localhost:3000/...)   at Request.<anonymous> (/Users/USERNAME/Desktop/projects/backstage/node_modules/got/dist/source/as-promise/index.js:118:42)
[4](http://localhost:3000/...)    at runMicrotasks (<anonymous>)
[5](http://localhost:3000/...)    at processTicksAndRejections (node:internal/process/task_queues:96:5)

MY_TOKEN is a gitlab private access token with the scopes api, read_api, read_registry, write_registry, read_repository, write_repository. It is used in the gitlab integration as well, and successfully pulls components from the server.

Figure it's gotta be something simple I'm missing, but error messaging hasn't been helpful. For repo url I've tried every combination of group name, repo, and adding .git on the end. None seem to work.

Node: v16.1.0
Backstage: 1.5.0

@benjdlambert
Copy link
Member

So I think that you want to drop the token: MY_TOKEN from template.yaml and it should start to work automatically as you have it defined in the integrations.config you shouldn't have to defined it twice. If that doesnt work then it could be something to do with the permissions for creating a repository in the right place. What are you setting in the RepoUrlPicker component as owner and host?

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@asayah
Copy link

asayah commented Sep 17, 2023

did you figure out the issue here @bb-k8 ?

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

No branches or pull requests

3 participants