Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-52041

can't use docker-compose - minimized workspace name start with underscore

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • branch-api-plugin
    • None
    • Jenkins 2.107.2

      For certain project names minimized workspace name will start with underscore:

      // add this test case to WorkspaceLocatorImplTest
      assertEquals("_my.service.name.abcde_PR-1-J66S6RX2LGBP3IYNJHSVLYWU5WQXTLZJDQRJIBNFPNM3HOWPZASQ",
        WorkspaceLocatorImpl.minimize("one/or/more/parent/elements/abcdefghijk/my.service.name.abcde/PR-1"));
      

      docker-compose uses directory name as container name (-p can be used to set custom name).

      Docker does not allow underscore as first letter of the container name.

      Because of that jobs that call docker-compose without -p will fail.

      Workarounds:
      1) use docker-compose -p
      2) use custom workspace name
      3) jenkins.branch.WorkspaceLocatorImpl.PATH_MAX=0 (or other value)

          [JENKINS-52041] can't use docker-compose - minimized workspace name start with underscore

          Bartosz Rempuszewski added a comment - - edited

          After some testing:

          • PATH_MAX=0 is not a good solution: two different projects with the same PR number will end up with the same docker-compose project name.
          • PATH_MAX=1 is an option, but directory names will be "<last character of PR name>-<10 characters of sha256 hash>" - quite obscure).
          • PATH_MAX=<number big enough to handle full service path + hash> can be used but very long names are also hard to read

          It would be great to use something like "<project-name>_<pr>-<hash from full path>"...

          Bartosz Rempuszewski added a comment - - edited After some testing: PATH_MAX=0 is not a good solution: two different projects with the same PR number will end up with the same docker-compose project name. PATH_MAX=1 is an option, but directory names will be "<last character of PR name>-<10 characters of sha256 hash>" - quite obscure). PATH_MAX=<number big enough to handle full service path + hash> can be used but very long names are also hard to read It would be great to use something like "<project-name>_<pr>-<hash from full path>"...

          Removing myself as assignee. My current work assignments do not provide sufficient bandwidth to review these issues and in the majority of cases I am only assigned by virtue of being the default assignee. For the credentials-api and scm-api related plugins I have permission to allocate time reviewing changes to these APIs themselves to ensure these APIs remain cohesive, but that can be handled through PR reviews rather than assigning issues in JIRA

          Stephen Connolly added a comment - Removing myself as assignee. My current work assignments do not provide sufficient bandwidth to review these issues and in the majority of cases I am only assigned by virtue of being the default assignee. For the credentials-api and scm-api related plugins I have permission to allocate time reviewing changes to these APIs themselves to ensure these APIs remain cohesive, but that can be handled through PR reviews rather than assigning issues in JIRA

          I just noticed in https://github.com/jenkinsci/branch-api-plugin/blob/master/src/main/java/jenkins/branch/WorkspaceLocatorImpl.java that PATH_MAX is deprecated.

          New option (MAX_LENGTH) does not fix this issue - in some cases it will generate workspace names with underscore prefix.

          Bartosz Rempuszewski added a comment - I just noticed in  https://github.com/jenkinsci/branch-api-plugin/blob/master/src/main/java/jenkins/branch/WorkspaceLocatorImpl.java  that PATH_MAX is deprecated. New option (MAX_LENGTH) does not fix this issue - in some cases it will generate workspace names with underscore prefix.

            Unassigned Unassigned
            rempusze Bartosz Rempuszewski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: