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

make generate - assumptions about remote names #509

Closed
jlewi opened this issue Oct 12, 2019 · 0 comments · Fixed by #665
Closed

make generate - assumptions about remote names #509

jlewi opened this issue Oct 12, 2019 · 0 comments · Fixed by #665

Comments

@jlewi
Copy link
Contributor

jlewi commented Oct 12, 2019

#466 modified the script to generate the updated tests to only generate tests for what's changed.

I get the following error

fatal: ambiguous argument 'origin/fix_backend..upstream/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
done
go fmt ./...

It looks like the script is making assumptions about the remote name that is used for the fork and the upstream.

A more robust approach is to find the remote based on the remote URL rather than assuming its named upstream.

I thought we had a shell script that was doing that but I can't remember which one.

I'm not sure what the script is computing the diff using the name of the remote fork e.g. "origin/fix_head" rather than just assuming its the local branch.

@jlewi jlewi added the kind/bug label Dec 12, 2019
jlewi pushed a commit to jlewi/manifests that referenced this issue Dec 12, 2019
* use git diff --name-only @{upstream} to compute the diff against the
  upstream branch. This should be better then the current branch
  which is making assumptions about the remote repo names.

* Furthermore we need to make sure that when the base kustomization package
  changes that we also regenerate the tests for the overlay packages.

  * to support that we replace gen-test-targets.sh with a python script.

  * The bash scripts are pretty impenetrable; migrating to python should
    make the code easier to maintain.

* The name of the go test files generated is slightly different from what
  the shell scripts were generating.

  * This is intended to make the naming more consistent

  * specifically  a/b/c/kustimazation.yaml results in
    tests/a-b-c_test.go

  * It looks like the shell script was sometimes not including a in the name.

* The python script also checks that for _test.go file there is a corresponding
  kustomization.yaml file; otherwise it will remove the test. This
  ensures if we move or remove a kustomize package we will end up
  removing the test.

* Fix: kubeflow#509

* Update the pull request template with the command to only generate
  tests for changed files

* Fix kubeflow#171 - gen-test-target.sh should function regardless
  of checked out name for the repository. We can use git to get the
  base directory and then do an appropriate string replace.

* Need to update the test target generation
  to not assume the repository is named manifests

* Update the github pull_request template to tell users to run `make generate-changed-only`
jlewi pushed a commit to jlewi/manifests that referenced this issue Dec 16, 2019
* use git diff --name-only @{upstream} to compute the diff against the
  upstream branch. This should be better then the current branch
  which is making assumptions about the remote repo names.

* Furthermore we need to make sure that when the base kustomization package
  changes that we also regenerate the tests for the overlay packages.

  * to support that we replace gen-test-targets.sh with a python script.

  * The bash scripts are pretty impenetrable; migrating to python should
    make the code easier to maintain.

* The name of the go test files generated is slightly different from what
  the shell scripts were generating.

  * This is intended to make the naming more consistent

  * specifically  a/b/c/kustimazation.yaml results in
    tests/a-b-c_test.go

  * It looks like the shell script was sometimes not including a in the name.

* The python script also checks that for _test.go file there is a corresponding
  kustomization.yaml file; otherwise it will remove the test. This
  ensures if we move or remove a kustomize package we will end up
  removing the test.

* Fix: kubeflow#509

* Update the pull request template with the command to only generate
  tests for changed files

* Fix kubeflow#171 - gen-test-target.sh should function regardless
  of checked out name for the repository. We can use git to get the
  base directory and then do an appropriate string replace.

* Need to update the test target generation
  to not assume the repository is named manifests

* Update the github pull_request template to tell users to run `make generate-changed-only`
k8s-ci-robot pushed a commit that referenced this issue Dec 16, 2019
* Fix computation of changed files in generate-changed-only rule

* use git diff --name-only @{upstream} to compute the diff against the
  upstream branch. This should be better then the current branch
  which is making assumptions about the remote repo names.

* Furthermore we need to make sure that when the base kustomization package
  changes that we also regenerate the tests for the overlay packages.

  * to support that we replace gen-test-targets.sh with a python script.

  * The bash scripts are pretty impenetrable; migrating to python should
    make the code easier to maintain.

* The name of the go test files generated is slightly different from what
  the shell scripts were generating.

  * This is intended to make the naming more consistent

  * specifically  a/b/c/kustimazation.yaml results in
    tests/a-b-c_test.go

  * It looks like the shell script was sometimes not including a in the name.

* The python script also checks that for _test.go file there is a corresponding
  kustomization.yaml file; otherwise it will remove the test. This
  ensures if we move or remove a kustomize package we will end up
  removing the test.

* Fix: #509

* Update the pull request template with the command to only generate
  tests for changed files

* Fix #171 - gen-test-target.sh should function regardless
  of checked out name for the repository. We can use git to get the
  base directory and then do an appropriate string replace.

* Need to update the test target generation
  to not assume the repository is named manifests

* Update the github pull_request template to tell users to run `make generate-changed-only`

* Address comments.

* Latest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant