Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes AppendManifest used to read files from kodata #428

Merged
merged 1 commit into from
Sep 27, 2021

Conversation

sm43
Copy link
Member

@sm43 sm43 commented Sep 27, 2021

Previously, if we pass a path to AppendManifest
for ex. /kodata/tekton/abc.yaml and later
/kodata/tekton/
both use to read the file and add in the manifest, which
would make manifest to have the same resource twice.

This patch updates the AppendManifest func to use mf.ManifestFrom
which will recursively read all files from a location by passing
the path to it.

Closes #425

Signed-off-by: Shivam Mukhade [email protected]

Changes

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Release Notes

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 27, 2021
@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/common/releases.go 32.4% 56.8% 24.4

@sm43 sm43 force-pushed the fix-append-manifest branch from 9e05f6d to 94835c9 Compare September 27, 2021 04:11
@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/common/releases.go 32.4% 56.8% 24.4

apiVersion: triggers.tekton.dev/v1alpha1
kind: ClusterTriggerBinding
metadata:
name: bitbucket-pullreq-0.0.2-copy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why duplicated file ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was testing having multiple files in the directory

@nikhil-thomas
Copy link
Member

Previously, if we pass a path to AppendManifest
for ex. /kodata/tekton/abc.yaml and later
/kodata/tekton/
both use to read the file and add in the manifest, which
would make manifest to have the same resource twice.

I think this should be solved by restructuring the file tree. This patch seems to be a bit too restrictive, because current way of doing will be the general expectation.

so if a data root has 2 separate things which are handled by 2 entities.
eg:

/kodata/tekton/abc.yaml 
/kodata/tekton/`

let us change that to

/kodata/tekton/abc-resources/abc.yaml and later
/kodata/tekton/main-resources/

note: main-resources or any other significant name.

@nikhil-thomas
Copy link
Member

/hold

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 27, 2021
@nikhil-thomas
Copy link
Member

Previously, if we pass a path to AppendManifest
for ex. /kodata/tekton/abc.yaml and later
/kodata/tekton/
both use to read the file and add in the manifest, which
would make manifest to have the same resource twice.

I think this should be solved by restructuring the file tree. This patch seems to be a bit too restrictive, because current way of doing will be the general expectation.

so if a data root has 2 separate things which are handled by 2 entities.
eg:

/kodata/tekton/abc.yaml 
/kodata/tekton/`

let us change that to

/kodata/tekton/abc-resources/abc.yaml and later
/kodata/tekton/main-resources/

note: main-resources or any other significant name.

it turns out my assumption is wrong here. This pr is actually trying to deduplicate Appending of manifest as manifestival doesnot check for duplicates.

so let us either move the changes in this patch into a function like (skipDir) and make the need for this change visible through a comment. The flow of logic in the for loop body will be simplified.

@sm43 sm43 force-pushed the fix-append-manifest branch from 94835c9 to e3e4b24 Compare September 27, 2021 11:54
Previously, if we pass a path to AppendManifest
for ex. `/kodata/tekton/abc.yaml` and later
        `/kodata/tekton/`
both use to read the file and add in the manifest, which
would make manifest to have the same resource twice.

This patch updates the AppendManifest func to use mf.ManifestFrom
which will recursively read all files from a location by passing
the path to it.

Signed-off-by: Shivam Mukhade <[email protected]>
@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/common/releases.go 32.4% 41.9% 9.6

@sm43 sm43 force-pushed the fix-append-manifest branch from e3e4b24 to 11f7b0e Compare September 27, 2021 11:58
Comment on lines +177 to +181
m, err := mf.ManifestFrom(mf.Recursive(yamlLocation))
if err != nil {
return err
}
for i := range files {
m, err := Fetch(files[i])
if err != nil {
return err
}
*manifest = manifest.Append(m)
}
*manifest = manifest.Append(m)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@nikhil-thomas
Copy link
Member

/hold cancel

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 27, 2021
@nikhil-thomas
Copy link
Member

/approve

@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nikhil-thomas

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 27, 2021
@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/common/releases.go 32.4% 41.9% 9.6

@nikhil-thomas
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 27, 2021
@tekton-robot tekton-robot merged commit b925224 into tektoncd:main Sep 27, 2021
@sm43 sm43 deleted the fix-append-manifest branch October 10, 2021 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TektonInstallerSet created have each resource twice
4 participants