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

Don't update api-reference docs if the only changes are the timestamps #16940

Merged

Conversation

caesarxuchao
Copy link
Member

Fix #16121

cc @jlowdermilk because I changed the REPO_DIR.
cc @lavalamp

@k8s-github-robot
Copy link

Labelling this PR as size/M

@k8s-github-robot k8s-github-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 6, 2015
@j3ffml
Copy link
Contributor

j3ffml commented Nov 6, 2015

Looks fine, script still reuses existing REPO_DIR. Jenkins unit/integration needs to pass in REPO_DIR to be able to run hack/verify-api-reference-docs.sh, so as long as test passes, lgtm.

# By now, the contents should be normalized and stripped of any
# auto-managed content.
if diff -Bw >/dev/null <(echo "${original}") <(echo "${generated}"); then
# actual contents same, overwrite generated with original.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should overwrite when the contents are different right?

Copy link
Contributor

Choose a reason for hiding this comment

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

aah ok. I see now.
Ignore

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's confusing. I copied this pattern from another hack/*.sh.

@nikhiljindal
Copy link
Contributor

LGTM, thanks!

@nikhiljindal nikhiljindal added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 6, 2015
@caesarxuchao
Copy link
Member Author

Restart the checks as I just upload the v4 image to gcr.

@caesarxuchao caesarxuchao reopened this Nov 6, 2015
@k8s-bot
Copy link

k8s-bot commented Nov 6, 2015

GCE e2e test build/test passed for commit 358221f.

@j3ffml
Copy link
Contributor

j3ffml commented Nov 6, 2015

Looks like this breaks dockerized test. You can repro locally by running

WORKSPACE=/tmp hack/jenkins/gotest-dockerized.sh

@@ -37,12 +47,40 @@ echo "Reading swagger spec from: ${SWAGGER_PATH}"
mkdir -p $V1_PATH
mkdir -p $V1BETA1_PATH

docker run --rm -v $V1_PATH:/output:z -v ${SWAGGER_PATH}:/swagger-source:z gcr.io/google_containers/gen-swagger-docs:v3 \
docker run -u $(id -u) --rm -v $V1_TEMP_PATH:/output:z -v ${SWAGGER_PATH}:/swagger-source:z gcr.io/google_containers/gen-swagger-docs:v4 \
Copy link
Member Author

Choose a reason for hiding this comment

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

The output is supposed to be written to $V1_TEMP_PATH, but when running in dockerized test, nothing is written.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, well there's your problem. The path that you pass to docker run -v PATH:/output will get resolved on the host, not the container. So it's actually writing to ${KUBE_TEMP} on your machine. See longer explanation here.

The tl;dr is that when you call docker run -v PATH:/containerpath ..., the PATH must be resolvable on the host. To have the above command write output that you can then read here, you have to pass in the host-resolvable path (i.e., use REPO_DIR), and then read that output using the local path (without REPO_DIR).

It's kind of confusing. If you give me a minute, I can send a pr to your branch that should fix.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @jlowdermilk! So I didn't understand your comments when I reviewed your PR, now it all makes sense!

As you said, the address I passed to -v will be resolved as a host-resolvable path, then we still need to use ${KUBE_TEMP}, there can be race condition if two dockerized tests are running at the same time. Am I right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Test runs don't share workspaces (the jenkins dir where the repo gets cloned down, from which dockerized tests run, mapping in REPO_DIR), so there's no race.

Copy link
Member Author

Choose a reason for hiding this comment

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

Great. That makes things easier.

# We pass the host output dir as the source dir to `docker run -v`, but use
# the regular one to compute diff (they will be the same if running this
# test on the host, potentially different if running in a container).
REPO_DIR=${REPO_DIR:-"${KUBE_ROOT}"}
Copy link
Member Author

Choose a reason for hiding this comment

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

@jlowdermilk I moved the reference to REPO_DIR from the verify script to the update script.

@caesarxuchao caesarxuchao force-pushed the dont-update-api-reference branch from 589f158 to 4e4c67c Compare November 7, 2015 01:04
@caesarxuchao
Copy link
Member Author

@jlowdermilk, updated. It passed my local dockerized tests. PTAL. Thank you very much for your help!

@k8s-github-robot
Copy link

PR changed after LGTM, removing LGTM.

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 7, 2015
HOST_OUTPUT_DIR="${REPO_DIR}/_tmp/api-reference"
TMP_OUTPUT_DIR="${KUBE_ROOT}/_tmp/api-reference"
HOST_OUTPUT_DIR="${KUBE_ROOT}/_tmp/api-reference"
mkdir -p ${HOST_OUTPUT_DIR}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would recommend calling this something else, since it's not a host resolvable path. OUTPUT_DIR is fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure.

@k8s-bot
Copy link

k8s-bot commented Nov 7, 2015

GCE e2e test build/test passed for commit 589f158da9e96685c04c7b6d3bac565dbbf9f6ac.

@k8s-bot
Copy link

k8s-bot commented Nov 7, 2015

GCE e2e test build/test passed for commit 4e4c67c.

@k8s-bot
Copy link

k8s-bot commented Nov 7, 2015

GCE e2e test build/test passed for commit bd302d9.

@j3ffml
Copy link
Contributor

j3ffml commented Nov 7, 2015

lgtm

@j3ffml j3ffml added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 7, 2015
@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Nov 7, 2015

GCE e2e test build/test passed for commit bd302d9.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

k8s-github-robot pushed a commit that referenced this pull request Nov 7, 2015
@k8s-github-robot k8s-github-robot merged commit da46dab into kubernetes:master Nov 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.

7 participants