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

Add export option for pipelinerun #1500

Merged
merged 1 commit into from
Feb 15, 2022

Conversation

chmouel
Copy link
Member

@chmouel chmouel commented Feb 2, 2022

add export option for pruns, same as pipeline. do the export function a
bit more generic so we can feed any tekton type we want.

Add another fix to use generateName and remove the name when the two of them are there.

Signed-off-by: Chmouel Boudjnah [email protected]

Changes

Submitter Checklist

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

  • Includes tests (if functionality changed/added)
  • Run the code checkers with make check
  • Regenerate the manpages, docs and go formatting with make generated
  • Commit messages follow commit message best practices

See the contribution guide
for more details.

Release Notes

@tekton-robot tekton-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Feb 2, 2022
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 2, 2022
@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/cmd/pipelinerun/export.go Do not exist 16.1%
pkg/export/export.go 100.0% 16.7% -83.3

@chmouel chmouel changed the title WIP: Add export option for pipelinerun Add export option for pipelinerun Feb 2, 2022
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 2, 2022
@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/cmd/pipelinerun/export.go Do not exist 16.1%
pkg/export/export.go 100.0% 95.2% -4.8

@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/cmd/pipelinerun/export.go Do not exist 16.1%
pkg/export/export.go 100.0% 92.0% -8.0

@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/cmd/pipelinerun/export.go Do not exist 16.1%
pkg/export/export.go 100.0% 92.0% -8.0

@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/cmd/pipelinerun/export.go Do not exist 16.1%
pkg/export/export.go 100.0% 92.0% -8.0

@chmouel
Copy link
Member Author

chmouel commented Feb 4, 2022

Suggested edit:

diff --git a/pkg/cmd/pipelinerun/export.go b/pkg/cmd/pipelinerun/export.go
--- pkg/cmd/pipelinerun/export.go
+++ pkg/cmd/pipelinerun/export.go
@@ -1,4 +1,18 @@
+// Copyright © 2022 The Tekton Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 package pipelinerun
 
 import (
 	"io"
diff --git a/pkg/export/export.go b/pkg/export/export.go
--- pkg/export/export.go
+++ pkg/export/export.go
@@ -1,4 +1,18 @@
+// Copyright © 2022 The Tekton Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 package export
 
 import (
 	"fmt"
diff --git a/pkg/export/export_test.go b/pkg/export/export_test.go
--- pkg/export/export_test.go
+++ pkg/export/export_test.go
@@ -1,4 +1,18 @@
+// Copyright © 2022 The Tekton Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 package export
 
 import (
 	"testing"

@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/cmd/pipelinerun/export.go Do not exist 16.1%
pkg/export/export.go 100.0% 92.0% -8.0

data, err := yaml.Marshal(p)
return pipelineExportRemoveExtraFields(string(data)), err
func TektonResourceToYaml(p interface{}) (string, error) {
// I gave up trying to do a generic function....
Copy link
Contributor

Choose a reason for hiding this comment

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

We can optimize it in upcoming iterations.
/lgtm

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 am not sure how to optimize tho 😅

if someone has any ideas how to streamline it i'll be happy to take it.

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 4, 2022
add export option for pruns, same as pipeline. do the export function a
bit more generic so we can feed any tekton type we want.

Use generateName instead of name when there is one

When there is a generateName and a name, use the generateName and unset
the name since that's what we want on export.

Signed-off-by: Chmouel Boudjnah <[email protected]>
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Feb 4, 2022
@tekton-robot
Copy link
Contributor

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

File Old Coverage New Coverage Delta
pkg/cmd/pipelinerun/export.go Do not exist 16.1%
pkg/export/export.go 100.0% 92.0% -8.0

@piyush-garg
Copy link
Contributor

/approve

@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: piyush-garg

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 Feb 8, 2022
Copy link
Member

@vinamra28 vinamra28 left a comment

Choose a reason for hiding this comment

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

/lgtm
looks good

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 15, 2022
@tekton-robot tekton-robot merged commit b764c62 into tektoncd:main Feb 15, 2022
piyush-garg added a commit that referenced this pull request Mar 9, 2022
#1498 | [Pradeep Kumar] update tkn v0.22.0 | 2022/02/01-22:04
#1499 | [Daniel Helfand] update tkn chocolatey package to v0.22.0 | 2022/02/02-10:17
#1503 | [Chmouel Boudjnah] Use ubuntu-rolling to build package | 2022/02/03-10:17
#1505 | [Shubham] Make `vendor` a PHONY target | 2022/02/07-10:50
#1500 | [Chmouel Boudjnah] Add export option for pipelinerun | 2022/02/15-12:01
#1484 | [mansi103] Checked existence of resources before deletion | 2022/02/16-13:46
#1513 | [tomonight] pass rest config when create tkn clients,fix the default QPS is to low(QPS is 5),can improve the concurrent | 2022/02/28-09:14
#1514 | [Piyush Garg] Bump deps of pipeline and triggers | 2022/02/28-13:53
#1509 | [mansi103] Adds chains version in output of tkn version command | 2022/03/01-12:52
#1440 | [Rémy Greinhofer] Add Chains management command | 2022/03/03-15:01
null | [Vincent Demeester] Fix vendoring | 2022/03/03-15:01
null | [Vincent Demeester] Temporary disable linting tarball package | 2022/03/03-15:01
null | [jbpratt] remove unnecessary filepath join | 2022/03/04-08:13
null | [jbpratt] gofmt -w test/e2e/* | 2022/03/04-08:27
null | [jbpratt] replace t.Errorf %w with %v | 2022/03/04-09:17
null | [PuneetPunamiya] Bump Tekton Hub CLI to latest | 2022/03/04-10:37
null | [Pradeep Kumar] fix missing Cursor with interactive start commands | 2022/03/04-12:13
null | [Chmouel Boudjnah] Fix tektoncd docs installation instructions | 2022/03/08-08:08
null | [Piyush Garg] Make chains namespace configurable | 2022/03/09-09:29
null | [Piyush Garg] Bump chains and hub deps | 2022/03/09-09:29

Signed-off-by: Piyush Garg <[email protected]>
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants