Skip to content

Shell out package#30

Merged
knative-prow-robot merged 2 commits into
knative:masterfrom
cardil:feature/shell-out
Nov 25, 2020
Merged

Shell out package#30
knative-prow-robot merged 2 commits into
knative:masterfrom
cardil:feature/shell-out

Conversation

@cardil
Copy link
Copy Markdown
Contributor

@cardil cardil commented Nov 24, 2020

Fixes #28

This shell out package should be treated as a bridge solution that will help Knative move out of using too much shell scripts. It will enable us using new Golang orchestrated tests, and build processes, and have the ability to shell out to scripts if needed.

This shell out package should be threated as a brigde solutions that
will help Knative move out of using to much shell scripts. It will
enable us using new Golang orchestrated tests, and build processes, and
have ability to shell out to scripts if needed.
@google-cla google-cla Bot added the cla: yes Indicates the PR's author has signed the CLA. label Nov 24, 2020
@knative-prow-robot knative-prow-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 24, 2020
@cardil
Copy link
Copy Markdown
Contributor Author

cardil commented Nov 24, 2020

/cc @vaikas @n3wscott

@cardil
Copy link
Copy Markdown
Contributor Author

cardil commented Nov 24, 2020

slinkydeveloper pushed a commit to slinkydeveloper/hack that referenced this pull request Nov 25, 2020
* adding rigging, stage for merging

* drop testbed, it was never finished.

* adding a more complex test to show rigging for porting

* adding e2e test

* work with kind

* rigging v2 impl, PoC

* a working demo.

* run the v2 example of rigging

* clean up poc for v2 of rigging

* revert pkg/test

* cleanup

* less debug

* rework how flags are used

* minor cleanup

* show that you can also run more than one feature.

* drop example code

* adding options, minor cleanup

* ville feedback

* no need to nil check append on arrays
Comment thread shell/assertions_test.go
Comment on lines +17 to +45
package shell_test

import (
"strings"
"testing"
)

type assertions struct {
t *testing.T
}

func (a assertions) NoError(err error) {
if err != nil {
a.t.Error(err)
}
}

func (a assertions) Contains(haystack, needle string) {
if !strings.Contains(haystack, needle) {
a.t.Errorf("wanted to \ncontain: %#v\n in: %#v",
needle, haystack)
}
}

func (a assertions) Equal(want, got string) {
if got != want {
a.t.Errorf("want: %#v\n got:%#v", want, got)
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use testify for that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wanted to avoid adding dependencies, as that opens a pandora box, of whether to vendor them or not.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess this pandora box has to be opened at some point right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not necessarily. In the ideal world I would see ALL contents of this repo, gradually being deprecated, and replaced by dedicated tools, and Golang code.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

exactly, to develop this golang code (eg embed other tools) you'll probably need managing dependencies anyway right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, But maybe in other repos then knative/hack?!? IDK

Copy link
Copy Markdown

@n3wscott n3wscott left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

/hold
Can you as a follow up or another commit to mark every exported method as // Deprecated: do not use this to avoid profiliation? I am hoping downstreams seeing the deprecated method in use will encourage other solutions.

Unhold if you want to do it as a followup. Thanks!!

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 25, 2020
@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 25, 2020
@knative-prow-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cardil, n3wscott

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

The pull request process is described here

Details 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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 25, 2020
@cardil
Copy link
Copy Markdown
Contributor Author

cardil commented Nov 25, 2020

Thanks, @n3wscott!

I'll do that as a follow up. I have an idea, of how to do it even more strict.

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 25, 2020
@knative-prow-robot knative-prow-robot merged commit c46a649 into knative:master Nov 25, 2020
@cardil cardil deleted the feature/shell-out branch November 25, 2020 23:04
cardil added a commit to cardil/knative-eventing that referenced this pull request Nov 25, 2020
knative-prow-robot pushed a commit to knative/eventing that referenced this pull request Nov 27, 2020
* Migrate upgrade tests to use new framework

* Lint fixes

* Fixing shell outs

* Removal of unneeded vandor

* Lint fixes

* Unit test fixes

* Update deps to include knative/pkg#1912

* Fix unit test when running without proper git checkout

* Using new shell-out package from knative.dev/hack

* Fixing code style

* Adjusting location of project file

We need to point ourselves to specific directory as our scripts are
location sensitive.

* Bash scripts work with set -Eeuo pipefail

* Upgrade knative.dev/hack to include knative/hack#30
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. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API to call out shell scripts & functions from within Golang

4 participants