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

Fix: determine whether the destination path already exists before clone #1175

Merged
merged 1 commit into from
Aug 12, 2022

Conversation

yuzp1996
Copy link
Contributor

@yuzp1996 yuzp1996 commented Aug 10, 2022

Changes

If directory ${GOPATH}/src/github.com/google/licenseclassifier exists and is not empty we should skip clone again or will cause an error.

Related Issue: tektoncd/pipeline#5193

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.

@tekton-robot tekton-robot requested review from dibyom and wlynch August 10, 2022 02:32
@tekton-robot
Copy link
Contributor

Hi @yuzp1996. Thanks for your PR.

I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot tekton-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 10, 2022
@yuzp1996 yuzp1996 force-pushed the main branch 2 times, most recently from e16c26b to fa351b7 Compare August 10, 2022 02:37
@yuzp1996
Copy link
Contributor Author

related Issue: tektoncd/pipeline#5193

@yuzp1996 yuzp1996 changed the title Fix: judge if the destination path already exists Fix: determine whether the destination path already exists before clone Aug 10, 2022
@yuzp1996
Copy link
Contributor Author

/kind bug

@yuzp1996
Copy link
Contributor Author

yuzp1996 commented Aug 10, 2022

I made the change to resolve the problem when running the e2e-upgrade-test.sh but I am not sure how to test this change.

I find that the file entrypoint.sh will be referenced here and will be copied to the image test-runner which is used to run the e2e upgrade test.
image

Looks like I need first build the test-runner image and replace the container image which runs the e2e upgrade test in the Prow job.

image

Is there any other test cluster to test this change? I am not sure of the step to test this change.

@lbernick
Copy link
Member

Thank you @yuzp1996!
I'm not sure exactly how to test this but here's what I'd try (maybe @afrittoli would have some more suggestions?)
First build the docker image that includes this file:
docker build tekton/images/test-runner -t test-runner
Then try running the unit tests with your newly built image and see if you still run into the licenses issue:
docker run -v <path-to-your-pipelines-clone>:/pipeline test-runner /pipeline/test/presubmit-tests.sh --unit-tests

(I'm suggesting unit tests here because they also run with the test-runner image, but don't require creating a k8s cluster. I haven't tested these commands because I unfortunately don't have a working docker setup right now :( I'm pretty sure the other args for the prow job are args for prow, not for tests.)

If this works we'll have to update the prow job to use a newer version of this image once it's built. It looks like the version of test-runner it's using isn't what the rest of our CI uses and I'm wondering if just updating the image would help.

@abayer
Copy link
Contributor

abayer commented Aug 10, 2022

/test plumbing-image-build

@tekton-robot
Copy link
Contributor

@abayer: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-dogfooding-mario-test
  • /test pull-tekton-plumbing-check-testgrid-config

In response to this:

/test plumbing-image-build

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@abayer
Copy link
Contributor

abayer commented Aug 10, 2022

/approve

Yeah, @lbernick's suggestion should be a good way to verify the behavior. That said, I'm pretty sure it's good. =) Once it's merged and new images get built overnight, I'll update the Prow config to use the new tag.

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 10, 2022
@abayer
Copy link
Contributor

abayer commented Aug 10, 2022

/test plumbing-yamlllint

@tekton-robot
Copy link
Contributor

@abayer: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-dogfooding-mario-test
  • /test pull-tekton-plumbing-check-testgrid-config

In response to this:

/test plumbing-yamlllint

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@abayer
Copy link
Contributor

abayer commented Aug 10, 2022

/test plumbing-yamllint

@tekton-robot
Copy link
Contributor

@abayer: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-dogfooding-mario-test
  • /test pull-tekton-plumbing-check-testgrid-config

In response to this:

/test plumbing-yamllint

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

git clone https://github.com/google/licenseclassifier ${GOPATH}/src/github.com/google/licenseclassifier
DIR="${GOPATH}/src/github.com/google/licenseclassifier"

if [ "$(ls -A $DIR)" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I'd change this line to

if [ -d "$DIR" ]; then

@tekton-robot tekton-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 10, 2022
@abayer
Copy link
Contributor

abayer commented Aug 10, 2022

fwiw, I've done the local test @lbernick described and it needs a bit of a tweak to docker run -v <path-to-repo>:/home/prow/go/src/github.com/tektoncd/pipeline -w /home/prow/go/src/github.com/tektoncd/pipeline test-runner -- ./test/presubmit-tests.sh --unit-tests.

When I run that, it works - that's what prompted me to suggest changing to -d, since using ls results in an unnecessary ls: cannot access '/home/prow/go/src/github.com/google/licenseclassifier': No such file or directory showing up in the logs. =)

@yuzp1996
Copy link
Contributor Author

Thanks for your review @lbernick @abayer !

Following @abayer 's suggestion, I changed the way to determine if the target path exists.

@yuzp1996 yuzp1996 requested a review from abayer August 11, 2022 02:48
@abayer
Copy link
Contributor

abayer commented Aug 11, 2022

/approve
/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 11, 2022
@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abayer

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 Aug 11, 2022
@dibyom
Copy link
Member

dibyom commented Aug 11, 2022

/ok-to-test

@tekton-robot tekton-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 11, 2022
If directory ${GOPATH}/src/github.com/google/licenseclassifier exists and
is not empty we should skip clone again or will cause an error.

Related Issue: tektoncd/pipeline#5193

Signed-off-by: yuzhipeng <yuzp1996@qq.com>
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 12, 2022
@yuzp1996
Copy link
Contributor Author

@abayer Sorry, I changed the git commit message and pushed it to the repository want to rerun one of the checks but caused the label lgtm to be removed! Can you add a lgtm label when you have time? Thanks!

@abayer
Copy link
Contributor

abayer commented Aug 12, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 12, 2022
@tekton-robot tekton-robot merged commit 0400bb7 into tektoncd:main Aug 12, 2022
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. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants