Skip to content

Helm rejects version numbers with build info that are valid according to the SemVer 2 standard #1698

Closed

Description

@itamarst

I'm building a Continuous Deployment pipeline. As such, I want charts/packages to include the git commit hash in their version; incrementing chart version numbers is less meaningful.

SemVer 2 has a mechanism for this, where versions can be 1.0.0+<build-info>: http://semver.org/#spec-item-10

Helm however does not support this part of the SemVer 2 standard:

Error: UPGRADE FAILED: Service "tracereader" is invalid: [metadata.labels: Invalid value: "tracereader-1.0.0+a056a76": must match the regex (([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])? (e.g. 'MyValue' or 'my_value' or '12345')

Activity

  1. itamarst commented on Dec 16, 2016

    @itamarst
    Author

    As a workaround I used prerelease versions (1.0.0-a056a76) instead of build versions (1.0.0+a056a76).

  2. changed the title [-]Helm rejects version numbers that are valid according to the SemVer 2 standard[/-] [+]Helm rejects version numbers with build info that are valid according to the SemVer 2 standard[/+] on Dec 16, 2016
  3. technosophos commented on Dec 16, 2016

    @technosophos
    Member

    I don't think this is directly related to SemVer so much as to a constraint on Kubernetes manifest file content.

    That error is Kubernetes complaining that + is an invalid string in a metadata.label value. I didn't know + was illegal in a value. Can you paste in here the metadata.labels section of whatever resource that is?

  4. itamarst commented on Dec 19, 2016

    @itamarst
    Author

    Problem is that the default Helm chart structure embeds versions in the metadata, I guess:

    itamarst@hexagon:/tmp $ helm create test
    Creating test
    itamarst@hexagon:/tmp $ more test/templates/service.yaml 
    apiVersion: v1
    kind: Service
    metadata:
      name: {{ template "fullname" . }}
      labels:
        chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"   <---- HERE
    ... etc. ...
    
  5. ralf-cestusio commented on Jan 6, 2017

    @ralf-cestusio

    I ran into the same problem.
    But you have access to that file. So you could set something else as label. For example strip the metadata from the semvar since it is not a distinguishing part of the version anyway.

  6. technosophos commented on Jan 11, 2017

    @technosophos
    Member

    I think maybe we should change the default chart to do something like {{ .Chart.Version | replace "+" "_" }}. I'm adding this as a bug fix for 2.1.4.

    /cc @prydonius

  7. added this to the 2.1.4 milestone on Jan 11, 2017
  8. technosophos commented on Jan 11, 2017

    @technosophos
    Member

    To be more specific, this is just a change to the defaultDeployment and defaultService constants at the top of pkg/chartutil/create.go

  9. lachie83 commented on Jan 11, 2017

    @lachie83
    Contributor

    I'm willing to pick this up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions