"message":"404 Not Found"

Hi Team,

I am trying to push helm chart onto the helm package repository using below curl command on my local virtual machine, but its failing with 404 Not found error as shown below:

[root@k8s-master helm]# curl --request POST --user : --form ‘chart=@nginx-0.1.0.tgz’ “https://gitlab.com/api/v4/projects/7294859/packages/helm/api/stable/charts
{“message”:“401 Unauthorized”}[root@k8s-master helm]#

I am using the curl command as given on the gitlab page:

curl --request POST
–form ‘chart=@mychart-0.1.0.tgz’
–user :<access_token>
https://gitlab.example.com/api/v4/projects/<project_id>/packages/helm/api//charts

Can you please assist in resolving this issue ?

Thanks,
Shantanu

Hi Shantanu,

If you are 100% sure that the chart exists, please check the access token again (if it has enough permissions, etc, as described on the same web page). 404s are happening if you are not well authenticated as well. Make sure to provide both username (=token name) and the token value:

--user <token-name>:<access-token-value>

Hi Team,

I tried using below command:
[root@k8s-master helm]# curl --request POST \

 --form 'chart=@nginx-0.1.0.tgz' \
 --user <token-name>:<deploy-token-value> \
 https://gitlab.example.com/api/v4/projects/57294859/packages/helm/api/stable/charts

[root@k8s-master helm]# ll
total 12
-rw-r–r–. 1 root root 182 May 3 12:17 deployment.yml
drwxr-xr-x. 4 root root 4096 May 3 12:16 nginx
-rw-r–r–. 1 root root 1649 May 3 14:02 nginx-0.1.0.tgz

But I m getting below error:
curl: (6) Could not resolve host: gitlab.example.com

Could you please help here ?

Thanks,
Shantanu Paranjpe

Hi Shantanu,

Well, you have to exchange gitlab.example.com with the domain of GitLab instance you are using… I would assume you’re on gitlab.com?

1 Like

Hi Paul,

Thanks for the help… Now I m able to push the chart to the package repo on gitlab. When I tried to do the same through the CICD pipeline, I am getting below error:

Pipeline code:
upload_image:
image: curlimages/curl:latest

stage: build
script:
- ‘curl --request POST --user Shantanu-1:$CI_JOB_TOKEN --form “chart=@nginx-0.1.0.tgz” “https://gitlab.com/api/v4/projects/7294859/packages/helm/api/stable/charts”’

Can you please check the same?

Thanks,
Shantanu

Hi Shantanu,

Now you are getting an error from curl itself. This kind of issues you should debug / research yourself, it has nothing to do with GitLab.

The first Google result: saucelabs - curl: (26) Failed to open/read local data from file/application - Stack Overflow suggests checking your quotes (single / double quoting when using curl is very sensitive). Please also in the future format your code in the post according to the community guidelines, so it is easier for everyone to read and spot potential syntax issues.