Repository navigation
Conversation
|
I have only one question here. Do we need a fallback mechanism for the delete-pipeline, delete-team and get-pipeline? For me it would be good to have such for some time. @taylorsilva , what do you think? |
|
@taylorsilva , could you please give me access to the PR checks so i can fix them? |
Signed-off-by: Kump3r <[email protected]>
Signed-off-by: Taylor Silva <[email protected]>
Signed-off-by: IvanChalukov <[email protected]>
Signed-off-by: IvanChalukov <[email protected]>
Signed-off-by: IvanChalukov <[email protected]>
Add support for IEC standard notation (KiB, MiB, GiB) alongside the existing traditional units (KB, MB, GB). Improve the regex pattern to handle abbreviated units (K, M, G) and ensure case insensitivity across all unit formats. No functional change to existing behavior - all units continue to use binary multipliers (2^10, 2^20, 2^30) as before. Signed-off-by: Mathias Bogaert <[email protected]>
When writing metadata files, the code was using O_WRONLY|O_CREATE flags without O_TRUNC. This could cause file corruption when writing shorter content than what existed previously, as the remaining bytes from the old content would persist in the file. The fix adds O_TRUNC to ensure clean overwrites and maintain data integrity. Signed-off-by: Mathias Bogaert <[email protected]>
Fix Fix New changes Fix Fixes Fix tests Signed-off-by: ceco556 <[email protected]>
Signed-off-by: ceco556 <[email protected]>
|
Sorry for the commits, my forked repo was not synced. |
|
I've added you to the Concourse org on Github. You will need to log out and then back in to https://ci.concourse-ci.org/, but then you should see the pipeline logs for your PR. |
|
Initial thought for the users that have pipelines with invalid identifiers, since I think the validation only happens client side, would be to add a flag to skip the validation check, This would be a final escape hatch for users that have ignored the warnings. |
|
I will implement it. Thanks for the suggestion. After log out and log in, i still don't see the PR checks. Other pipelines are visible now. Did i miss something? |
|
I can see that you haven't accepted the invitation yet. I'm not sure how you see it on your end, but I think if you go here it may show something: https://github.com/concourse Invite might show up here as well: https://github.com/notifications |
|
Ah, yes, found it! |
|
Ignore the The unit test failures are legit though: https://ci.concourse-ci.org/builds/464630948#L6821cb41:627:654 |
|
The unit job timed out right at the end. I've retriggered it. Is it normal to time out ? I think i managed to fix the unit test, now i have to take a look at the testflight tests. |
|
Sadly the time out is normal. There's only one worker for all PR's right now which creates a bottleneck and these timeouts are one side effect. Hopefully we can get more PR workers soon. |
|
While fixing the testflight tests i found one issue. If you try to set a pipeline with set_pipeline step in it such as: It will return error because the name ((pipeline_name)) has invalid identifier - "(". |
|
I've added new checks to handle placeholders in identifiers. A new regex pattern is introduced to detect them. If an idetifier contains placeholder, the validation will process the remaining parts of the identifier after removing the placeholder. One more thing we should discuss. After implementing the --skip-validation flag i didn't write tests for it. @taylorsilva , will this be a temporary flag and should i write tests for it? |
|
I'm going to take a look at this today and answer some of the questions you've brought up. Could you also please sign-off your commits 🙏 |
There was a problem hiding this comment.
Overall we're on the right track here.
The majority of my feedback basically boils down to: delete more code! 😀
I think anywhere where we were returning an atc.ConfigWarning can be consolidated into the error that was returned along with the ConfigWarning. That should result in code being deleted and simplify method signatures to return only error instead of warnings and errors.
Also great job adding the SkipValidation escape hatch for various fly commands 👏
| type SaveConfigResponse struct { | ||
| Errors []string `json:"errors,omitempty"` | ||
| Warnings []ConfigWarning `json:"warnings,omitempty"` | ||
| Errors []string `json:"errors,omitempty"` | ||
| ConfigErrors []ConfigErrors `json:"configerrors,omitempty"` | ||
| } |
There was a problem hiding this comment.
Do we need both fields still? I think we can refactor this to:
type SaveConfigResponse struct {
Errors []string `json:"errors,omitempty"`
}Similar to what you did for SetTeamResponse:
concourse/atc/api/teamserver/set.go
Line 14 in 0941988
Feels redundant to have two fields that contain errors.
| 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\-_.])`) | ||
| var placeholderRegex = regexp.MustCompile(`\(\([a-zA-Z0-9_\-\.]+\)\)`) |
There was a problem hiding this comment.
I don't think we should do this. I think this risks allowing users to accidentally create pipelines with the vars syntax in the name. I'll play around with this a bit to see how we can make this work for the set_pipeline step.
| var warnings []atc.ConfigWarning | ||
| func validateResources(c atc.Config) ([]atc.ConfigErrors, error) { | ||
| var errorMessages []string | ||
| var configErrors []atc.ConfigErrors |
There was a problem hiding this comment.
I think we can consolidate this into just errorMessages now and remove configErrors. Let me know if I'm missing something here and there's a reason we need to keep both.
func validateResources(c atc.Config) error {
//...
}| func validateResourceTypes(c atc.Config, seenTypes map[string]location) ([]atc.ConfigErrors, error) { | ||
| var errorMessages []string | ||
| var configErrors []atc.ConfigErrors |
| var warnings []atc.ConfigWarning | ||
| func validatePrototypes(c atc.Config, seenTypes map[string]location) ([]atc.ConfigErrors, error) { | ||
| var errorMessages []string | ||
| var configErrors []atc.ConfigErrors |
| CheckCredentials bool | ||
| DryRun bool | ||
| CommandWarnings []concourse.ConfigWarning | ||
| CommandErrors []atc.ConfigErrors |
There was a problem hiding this comment.
I don't think this field is will be needed anymore if you consolidate to just return error instead of using []atc.ConfigErrors everywhere still.
| func (command *SetPipelineCommand) Validate() ([]atc.ConfigErrors, error) { | ||
| var configErrors []atc.ConfigErrors |
There was a problem hiding this comment.
dup: consolidate to return error only
func (command *SetPipelineCommand) Validate() error {| sess, err := gexec.Start(flyCmd, GinkgoWriter, GinkgoWriter) | ||
| Expect(err).NotTo(HaveOccurred()) | ||
|
|
||
| Eventually(sess.Err.Contents).Should(ContainSubstring(`error: team 'doesnotexist' does not exist`)) |
There was a problem hiding this comment.
Can we keep the ContainSubstring() checks in these tests?
| Expect(err).ToNot(HaveOccurred()) | ||
|
|
||
| Eventually(sess).Should(gexec.Exit(0)) | ||
| Expect(sess.Out).To(gbytes.Say(fmt.Sprintf("pipeline successfully renamed to '%s'", newName))) |
There was a problem hiding this comment.
nit: can we keep the output check here?
| _, _, _, warnings, err := team.CreateOrUpdate(desiredTeam) | ||
| Expect(err).NotTo(HaveOccurred()) | ||
| Expect(warnings).To(HaveLen(1)) | ||
| Expect(warnings[0].Message).To(ContainSubstring("team: 'new venture' is not a valid identifier")) |
There was a problem hiding this comment.
nit: can we still check for the string?
|
Hi @taylorsilva, Thanks for the code review. While addressing your comments i encountered issues with the integration tests for fly.(set_pipeline_test.go) |
|
Another thing i forgot to mention. |
|
Thanks @ceco556! I'm a bit backlogged right now so it'll take a while for me to circle back here, hopefully next week when you're back. Once I have time I'll dig into the tests. This comment here also pointed out a similar issue that you ran into with the Not sure how we'll tackle this right now. We can dig into it more next week hopefully. |
|
Hi @taylorsilva, did you have time to dig in this PR? I have concerns regarding the failing tests and how we will handle the placeholders in the set_pipeline step. Even we skip the check for invalid identifiers in the set_pipeline step, there are a lot failing tests which have to be rewritten. |
|
I haven't had a chance yet, but this PR has been in my head for the last few weeks. I have the same concerns as you and I'm not feeling good about the possible paths in front of us. I've been feeling a bit tempted to have fields like the name of tasks not be considered |
|
Heads up, I'm going to focus on the next release (7.14), so I won't get back to this PR until after that is done. This is top of the list though for me to review after the next release is out. |
|
Hey, FINALLY circling back to this. So it seems our biggest issue is with handling vars jobs:
- name: sp-1
public: true
plan:
- get: some-resource
- set_pipeline: ((pipeline_name))
file: some-resource/pipeline.yml
var_files:
- some-resource/name.yml
vars:
greetings: helloWhat confuses me about this is: when is resources:
- name: mock
type: mock
source:
create_files:
pipeline.yml: |
resources:
- name: mock
type: mock
jobs:
- name: job
plan:
- get: mock
jobs:
- name: sp
plan:
- get: mock
- set_pipeline: ((pipeline_name))
file: mock/pipeline.ymland If I set this pipeline again with What workflow were you conveying when you shared this pipeline? I decided to see where vars currently work through out a pipeline. I think I found some bugs related to how and when Concourse interpolates vars, but I think we can get away with ignoring those for now for the sake of this PR. First, there are three "types" of vars that Concourse can interpolate:
I created the following pipeline to play around with these different types of vars in various situations. Click to view pipelinevar_sources:
- name: varsrc
type: dummy
config:
vars:
task-name: my-vars
child-pipe: child_pipe
resources:
- name: mock
type: mock
jobs:
- name: job
plan:
- get: image
resource: mock
params:
mirror_self_via_params: true
- get: mock
params:
create_files_via_params:
vars.yml: |
task_name: some_task_name
invalid_task_name: invalid task name
child-pipe: child_pipe
pipe.yml: |
resources:
- name: mock
type: mock
jobs:
- name: job
plan:
- get: mock
- load_var: my-vars
reveal: true
file: mock/vars.yml
- across:
- var: acr
values:
- 123
- abc
in_parallel:
# is currently allowed and should remain so
# should we error if the identifier is not valid???
- task: ((.:acr))
image: image
config:
platform: linux
run:
path: bash
args:
- -ec
# referncing var_sources does not work ((varsrc:child-pipe)) inside across steps
# results in error: missing source 'varsrc' in var: varsrc:child-pipe
# referencing ((.:my-vars)) does work! it is interpolated
- |
echo ((.:my-vars.child-pipe))-((.:acr))
# does not warn, will create a pipeline with the literal var `(( ))` as the name
# ((.:my-vars)) is not interpolatd
# ((.:acr)) is interpolated
# ((varsrc:)) results in an error during runtime: missing source 'varsrc'. I think this means lookups from secrets manager may also fail...
- set_pipeline: ((.:my-vars.child-pipe))-((.:acr))
file: mock/pipe.yml
# currently warns, and should not be allowed moving forward
- task: ((.:task-name))
image: image
config:
platform: linux
run:
path: bash
args:
- -ec
- |
echo ((.:my-vars.child-pipe))-((varsrc:child-pipe))
# it seems we detect the var, but it's never actually interpolated. We end
# up with a bad pipeline name. The step should error.
- set_pipeline: ((.:my-vars.child-pipe))
file: mock/pipe.ymlThere are a number of different cases we have to deal with here. Overall, I found the variable interpolation within What does this all mean for this PR? There are various places where "validation" happens and we can check identifiers. I think when setting a pipeline, we can ignore any vars found inside During runtime, I think I would like to see the Those are my thoughts right now. I'm interested in your response to the first section of my post here. Let me know your thoughts! Sorry for the longggg post 😬 |
|
Hi @taylorsilva, I am sorry for the late response. Last couple of months were very interesting for me and i didn't have much time to work on this. I am not sure i will be able to continue the work on this PR next weeks, maybe months. From what you've said, i totally agree with that to validate only what is outside of the across step. My only concern here is the tests. There are a tons of failing tests after the requested changes from you which must be fixed to handle these errors. I am not the best GO test developer and i am not sure i can handle them 😄 I will be very grateful for any help on this PR. I am totally fine if someone wants to continue the work and fix the tests. Let me know what do you think. |
|
Totally cool if you want to drop this PR. It is a tricky issue and was an informative exercise for the project. Feel free to close the PR. |


Changes proposed by this PR
closes #9271
closes #8725
closes #8475
Notes to reviewer
I changed Warnings to be ConfigErrors. Let me know if you are okay with this. If needed i will rename it to IdentifierErrors or something else.
Release Note
Fly commands now will return Error when there is invalid identifiers found.
If there is set_pipeline step with invalid identifier in a pipeline and you try to set it, it will return Error.