Project Job Token Scopes requests result in 404.
Closed this issue · 2 comments
Description
- Node.js version: 20.18.0
- Gitbeaker version: 41.3.0
- Gitbeaker release (cli, rest, core, requester-utils): rest
- OS & version: MacOS 14.7.1
Trying to call ProjectJobTokenScopes.addToInboundAllowList
results in not found.
req Request {
method: 'POST',
url: 'https://gitlab.com/api/v4/sourceProjectId/job_token_scope/allowlist',
headers: Headers {
'content-type': 'application/json',
'private-token': '<token>'
},
destination: '',
referrer: 'about:client',
referrerPolicy: '',
mode: 'cors',
credentials: 'same-origin',
cache: 'default',
redirect: 'follow',
integrity: '',
keepalive: false,
isReloadNavigation: false,
isHistoryNavigation: false,
signal: AbortSignal { aborted: false }
}
file:///Users/*******/node_modules/@gitbeaker/rest/dist/index.mjs:41 throw new GitbeakerRequestError(response.statusText, {
GitbeakerRequestError: Not Found
Steps to reproduce
Please find example script attached. This example takes in two known project ids and tries to add the target projectId to the allowlist of the source project. (obviously will require being manually replace in the code snippet)
import { Gitlab } from '@gitbeaker/rest';
if (!process.env.GITLAB_PROJECT_ACCESS_TOKEN) {
throw Error('GITLAB_PROJECT_ACCESS_TOKEN not set');
}
const api = new Gitlab({
token: process.env.GITLAB_PROJECT_ACCESS_TOKEN, });
export const main = async () => {
try {
await api.ProjectJobTokenScopes.addToInboundAllowList("sourceProjectId", "targetProjectId")
} catch (e: any) {
console.log("req", e.cause.request)
throw e
}
}
main()
Expected behaviour
Should add the targetProjectId to the source project allow list. As outlined here:
https://docs.gitlab.com/ee/api/project_job_token_scopes.html#add-a-project-to-a-cicd-job-token-inbound-allowlist
Actual behaviour
404
Possible fixes
Looks like the implementation of the ProjectJobTokenScopes Resource is excluding projects
from the path for example: here
endpoint`${projectId}/job_token_scope`
should become:
endpoint`projects/${projectId}/job_token_scope`
Checklist
- I have checked that this is not a duplicate issue.
- I have read the documentation.
Typo on my end after doing a refactor earlier this year! Ill fix this up
🚀 Issue was released in 42.0.0
🚀