nflaig / semantic-release-helm

semantic-release plugin to publish Helm charts
MIT License
13 stars 11 forks source link

Unable to publish to gitlab package registry #30

Open jwhitcraft opened 7 months ago

jwhitcraft commented 7 months ago

Since this always assume that the registry is an OCI registry, it doesn't publish to gitlab.

"semantic-release-helm3",
      {
          "chartPath": ".",
          "isChartMuseum": false,
          "registry": "https://gitlab.com/api/v4/projects/12345678/packages/helm/release",
          "skipRegistryLogin": true
      }

and I get this error when i try and publish

An error occurred while running semantic-release: Error: Command failed with exit code 1: helm push /builds/test/devops/charts/test/gustpTest-1.1.1.tgz oci://https://gitlab.com/api/v4/projects/12345678/packages/helm/release
Error: invalid_reference: invalid repository
nflaig commented 7 months ago

I am not familiar with what gitlab uses but might have to implement something similar to github https://github.com/nflaig/semantic-release-helm/blob/b1647baeeab7f3f33f5699126688ce41d1b66ac7/lib/publish.js#L124

jwhitcraft commented 7 months ago

So i got this working with the following config

    {
          "chartPath": ".",
          "isChartMuseum": true,
          "registry": "https://gitlab.com/api/v4/projects/1234567/packages/helm/release",
          "skipRegistryLogin": true,
          "cmPushArgs": "-d"
      }

and just doing the helm registry login in my before_step of my pipeline since if it's gitlab you need the whole repo on it, not just gitlab.com

3j0s commented 7 months ago

Greetings! I got the same issue that @jwhitcraft had weeks ago since I'am not be able to publish on my gitlab registry, although I could register on gitlab on "before_script":

    helm repo add --username ${REGISTRY_USERNAME} --password ${REGISTRY_PASSWORD} semantic-release-helm  ${REGISTRY_HOST}

This is the configuration that I have:

          {
            "chartPath": . ,
            "registry": "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/${CI_COMMIT_BRANCH}",
            "isChartMuseum": true,
             "skipRegistryLogin": true
          }

And still it doesn't works, this the error that I get

[7:19:25 PM] [semantic-release] › ✘  Failed step "publish" of plugin "semantic-release-helm3"
[7:19:25 PM] [semantic-release] › ✘  An error occurred while running semantic-release: Error: Command failed with exit code 1: helm cm-push . semantic-release-helm
.
.
.
. Error: 413: could not properly parse response JSON: Request Entity Too Large
nflaig commented 7 months ago

[7:19:25 PM] [semantic-release] › ✘ Failed step "publish" of plugin "semantic-release-helm3" [7:19:25 PM] [semantic-release] › ✘ An error occurred while running semantic-release: Error: Command failed with exit code 1: helm cm-push . semantic-release-helm . . . . Error: 413: could not properly parse response JSON: Request Entity Too Large

This looks like an error from the gitlab server, the payload you are sending is too large

3j0s commented 7 months ago

For some reason I did everything from the scratch and now it's seems that is working even the version increment, nevertheless I noticed that although the tag and chart version works fine, the Chart.yaml is not updated in the source main project. Btw: Thx for this plugin

nflaig commented 7 months ago

the Chart.yaml is not updated in the source main project

Might be a configuration on semantic release itself, version update is independent from any registry, you can check your release logs for this https://github.com/nflaig/semantic-release-helm/blob/b1647baeeab7f3f33f5699126688ce41d1b66ac7/lib/prepare.js#L12-L13

Note that it also part of prepare step, so if that would fail (e.g. due to file permissions) the publish wouldn't have worked.