Skip to content

ProjectJobTokenScope gives POST error: id is invalid #605

@SimplicityApks

Description

@SimplicityApks

What happened?

Adding a ProjectJobTokenScope does not work. It could be not encoding the id properly

output of pulumi up:

Updating (prod):                                                                                                                                                                                                                                                                                                                                                         
     Type                                  Name                Status                  Info                                                                                                                                                                                                                                                                              
     pulumi:pulumi:Stack                   customer-prod       **failed**              1 error                                                                                                                                                                                                                                                                           
 +   └─ gitlab:index:ProjectJobTokenScope  urnname  **creating failed**     1 error                                                                                       

Diagnostics:
  pulumi:pulumi:Stack (customer-prod):
    error: update failed

  gitlab:index:ProjectJobTokenScope (urnname):
    error: GitLab API error occurred: Unable to add the target project to CI/CD Job Token inbound allowlist: POST https://gitlaburl.domain/api/v4/projects/mynamespace/myproject/job_token_scope/allowlist: 400 {error: id is invalid}

Additionally, I haven't yet found a way to turn on the limit token access allowlist itself. So this has it manually turned on in the UI. Note I also tried before to add the project in the UI, but that should not make a difference I suppose.

Example

code:

new gitlab.ProjectJobTokenScope(
      "urnname",
      {
        targetProjectId: 36,
        project: "mynamespace/myproject",
      },
      { provider: gitlabProvider }
    );

pulumi preview detail shows

        gitlab:index/projectJobTokenScope:ProjectJobTokenScope: (create)                                                                                                                                                                                                                                                                                                   
        [urn=urn:pulumi:prod::customer::gitlab:index/projectJobTokenScope:ProjectJobTokenScope::urnname]                                                                                                                                                                                                                                                      
        [provider=urn:pulumi:prod::customer::pulumi:providers:gitlab::gitlab::683c86b5-4a31-4078-b9ed-e6def5f1cb42]                                                                                                                                                                                                                                                      
        project        : "mynamespace/myproject"                                                                                                                                                                                                                                                                                                                      
        targetProjectId: 36                                                                                                                                                                                                                                                                                                                                              

Output of pulumi about

CLI
Version 3.115.2
Go Version go1.22.2
Go Compiler gc

Plugins
KIND NAME VERSION
language nodejs unknown

Host
OS debian
Version 11.9
Arch x86_64

This project is written in nodejs: executable='/home/user/.nvm/versions/node/v20.12.2/bin/node' version='v20.12.2'

Current Stack: organization/customer/prod

pulumi gitlab is running in version:
"node_modules/@pulumi/gitlab": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/@pulumi/gitlab/-/gitlab-6.9.0.tgz",
"integrity": "sha512-307WjG9haMRzDBE69MPTolGmev95wh7TkyRaIrG0FMS7JUqr0JtWSX/kui5dlklJTY7AJTeao+KFs1x6NmC1XA==",
"dependencies": {
"@pulumi/pulumi": "^3.0.0",
"builtin-modules": "3.0.0",
"read-package-tree": "^5.2.1",
"resolve": "^1.7.1"
}
},

Additional context

We have our own gitlab server, both projects share a group. All other settings (e.g. adding ProjectVariables) via the same provider works fine.

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting-upstreamThe issue cannot be resolved without action in another repository (may be owned by Pulumi).kind/bugSome behavior is incorrect or out of spec

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions