Skip to content

Fly cannot delete Instanced Pipelines with Special Characters #8725

Open

Description

@theunpleasantowl

Summary

Steps to reproduce

Create a instanced-pipeline with commas or other special characters:

fly -t my-team set-pipeline --pipeline my-group -c pipeline.yml --instance-var env=prod,staging,dev

then run

fly -t my-team destroy-pipeline --pipeline my-group/env:"prod,staging,dev"

Expected results

Either I should not be allowed to create a pipeline instance that contains commas, or there should be a documented way to delete it through fly.

Double-quoting or using escape characters should also allow me to delete it.

Actual results

fly -t my-team destroy-pipeline --pipeline my-group/env:"prod,staging,dev"
!!! this will remove all data for pipeline `my-group/env:prod`

fly -t my-team destroy-pipeline --pipeline my-group/env:"prod\,staging\,dev"
!!! this will remove all data for pipeline `my-group/env:prod\\`

Triaging info

  • Concourse version: v7.8.3

Activity

  1. xtremerui commented on May 18, 2023

    @xtremerui
    Contributor

    Please try
    fly -t my-team destroy-pipeline --pipeline my-group/env:\"prod,staging,dev\"

    Basically it will need to quote the instance var value and escape the quotes at the same time. Sorry this is not very well documented.

  2. theunpleasantowl commented on Jun 1, 2023

    @theunpleasantowl
    Author

    Unfortunately, this does not seem to work for me.

    Regular name works:

    tom@nix:~/concourse$  fly -t my-team destroy-pipeline --pipeline my-group/env:prod
    !!! this will remove all data for pipeline `my-group/env:prod`
    
    are you sure? [yN]: y
    `my-group/env:prod` deleted
    

    Special character names don't:

    tom@nix:~/concourse$  fly -t my-team destroy-pipeline --pipeline my-group/env:\"prod,staging,dev\"
    !!! this will remove all data for pipeline `my-group/env:"prod,staging,dev"`
    
    are you sure? [yN]: y
    `my-group/env:"prod,staging,dev"` does not exist
    
  3. lcouto1 commented on May 2, 2024

    @lcouto1

    was there a fix for this?

  4. taylorsilva commented on Jan 7, 2025

    @taylorsilva
    Member

    No fix for this, we should make it very hard/not possible to use characters like this (that's my quick take at least)

  5. PiotrLuboch commented on Apr 9, 2025

    @PiotrLuboch

    There is a hack to remove the pipeline, you have to use the concourse api directly.

    Let's say you created a pipeline named test/pipeline:aaa,bbb for team test. First you need to encode the pipeline name: test%2Fpipeline%3Aaaa%2Cbbb. Then you need to call the API directly:

    curl -X DELETE <the-concourse-url>/api/v1/teams/test/pipelines/test%2Fpipeline%3Aaaa%2Cbbb --verbose -H "Authorization: bearer <token>"

  6. ceco556 commented on Apr 13, 2025

    @ceco556
    Contributor

    I think pipeline names should only include alphanumeric characters( a-z, A-Z, 0-9 ), underscores( _ ) or dashes ( - ). Using a regex would be a good approach to prevent any invalid characters.

    I'd be happy to implement this. @taylorsilva , what do you think?

  7. taylorsilva commented on Apr 15, 2025

    @taylorsilva
    Member

    @ceco556 Pipeline names already have warnings/checks to warn against stuff like this: https://github.com/concourse/concourse/blob/master/atc/configwarning.go

    EDIT: Just ran a quick test because I doubted myself and I remembered wrong! The pipeline name is also not validated! I thought it was just the instance vars and their values. I would accept a PR then that adds warnings for bad pipeline names (e.g. pipe-), similar to what we have to other identifiers which I linked to above and is now crossed out.


    Rest of original message

    What's not being checked is the values of the pipeline's instance vars.

    A pipeline name used to be just the name you'd pass in with --pipeline, but now it's the combination of that name and the instance var(s).

    return PipelineRef{
    Name: p.Name,
    InstanceVars: p.InstanceVars,
    }

    A different fix might be to change how we allow users to interact with instance pipelines with fly. I'm not a big fan of the current setup myself. I always forget the format and it feels finicky to work with. I'd be open to someone's attempt to improve the UX at the fly-level as I think that would also solve this problem.

    We could also add warnings similar to what we do for pipeline names and other identifiers in pipelines (resource names, step names, etc) but for the values of instance vars, to discourage users from using special characters.

    I'd be open to accepting contributions for both or one of those solutions.

  8. taylorsilva commented on Apr 15, 2025

    @taylorsilva
    Member

    The original RFC that added the identifier checks included pipeline names in the list of things to check: https://github.com/concourse/rfcs/blob/master/040-valid-identifiers/proposal.md

    It seems we never got around to adding that part though as I don't get any warnings from fly when I do fly set-pipeline --pipeline test- -c pipeline.yml.

    There are many pieces that can be tackled here. If you have bandwidth to work on any of this it would be much appreciated 🙏

  9. ceco556 commented on May 8, 2025

    @ceco556
    Contributor

    Hi @taylorsilva, i am sorry for the late response. I've checked what you suggested and started working on it.
    I have one concern. If we use ValidateIdentifier to validate the pipeline name this will override the check regarding "/":

    if strings.Contains(command.PipelineName, "/") {
    err = errors.New("pipeline name cannot contain '/'")
    }

    If we use ValidateIdentifier the character "/" will be already caught by the regex and will return a warning instead of error:

    var validIdentifiers = regexp.MustCompile(`^[\p{Ll}\p{Lt}\p{Lm}\p{Lo}\d][\p{Ll}\p{Lt}\p{Lm}\p{Lo}\d\-_.]*$`)
    var startsWithLetterOrNumber = regexp.MustCompile(`^[^\p{Ll}\p{Lt}\p{Lm}\p{Lo}\d]`)
    var justNumbers = regexp.MustCompile(`^\d+$`)
    var invalidCharacter = regexp.MustCompile(`([^\p{Ll}\p{Lt}\p{Lm}\p{Lo}\d\-_.])`)

    My suggestion here is to return error when there is invalid character caught from the ValidateIdentifier instead of warnings but this will be applied for each command which uses it. Should i change it to return error? What do you think?

  10. taylorsilva commented on May 8, 2025

    @taylorsilva
    Member

    Reading the identifiers RFC a bit more, there is a section about transitioning from warnings to errors: https://github.com/concourse/rfcs/blob/master/040-valid-identifiers/proposal.md#easing-the-transition

    After one year, we can turn these warnings into errors.

    We are well past the one year point. Users have had 5 years to update their pipelines to conform with the identifier restrictions. I say we go ahead and start enforcing them starting with v8.

    I'm going to add this as another breaking change for v8 of Concourse: #9184

    Is this something you'd be able to work on? This would cover a lot of things and there will probably be quite a few tests that need to be updated.

  11. ceco556 commented on May 8, 2025

    @ceco556
    Contributor

    Yes, i would be happy to implement this.
    I will keep you updated and open a PR once i am done.

  12. taylorsilva commented on May 8, 2025

    @taylorsilva
    Member

    Feel free to drop a message in the #dev channel in discord if you need any help or pointers.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions