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

[DONOT MERGE]Cache thirdparty pacakge on CI system, TEST CI #9150

Closed
wants to merge 17 commits into from

Conversation

Yancey1989
Copy link
Contributor

@Yancey1989 Yancey1989 commented Mar 16, 2018

@helinwang
Copy link
Contributor

helinwang commented Mar 19, 2018

Thanks for the amazing PR!

TeamCity CI is very special in the sense that nvidia-docker command is run outside of docker container. We should not let TeamCity CI run arbitrary script outside of docker, otherwise it's a big security risk.

For example, currently docker/build.sh is run inside of docker, but the command to start the container (nvidia-docker run ... docker/build.sh) is configured by admin in TeamCity. In this way, even when a PR which changes build.sh is created, the build.sh run only inside the container, causing no damage to the host build agent if it's malicious. On the other hand, if teamcity/pr_build.sh is checked in, and CI configured to run it directly, it will run on the host system directly (outside of docker).

Maybe this PR can be documented in the wiki, and configured in the TeamCity PR build script settings?

-e "WITH_COVERAGE=ON" \
-e "COVERALLS_UPLOAD=ON" \
-e "GIT_PR_ID=${PR_ID}" \
-e "JSON_REPO_TOKEN=JSUOs6TF6fD2i30OJ5o2S55V8XWv6euen" \
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this token sensitive data :) ?

Copy link
Contributor Author

@Yancey1989 Yancey1989 Mar 20, 2018

Choose a reason for hiding this comment

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

Sure...my mistake and removed it.

@Yancey1989
Copy link
Contributor Author

Thanks for @helinwang! It's a very important reminder. And maybe we can review this PR and then close && move the script to a wiki page after approved.


# Do not build dev image for now

if [[ "%WITH_UBUNTU_MIRROR%" == "ON" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Can test if Dockerfile is not changed, then we can skip building the image.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

May not, a PR job may run on any node of the CI cluster, for one PR changes the Dockerfile and merged, the next PR run another node without changing of Dockerfile, and it would use the older dev Docker image, we do not want this. For another side,docker build would use the cached image Layer if Dockerfile has no changs, would not cost too much time.

Copy link
Contributor

@helinwang helinwang Mar 21, 2018

Choose a reason for hiding this comment

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

Does it make sense to tag the docker image with the hash of the Dockerfile? (and remove all other tags when a PR builds)
E.g.,
docker image:
paddlepaddle/paddle:dev-000000
paddlepaddle/paddle:dev-000001

If the hash is 000001, then use paddlepaddle/paddle:dev-000001 and remove paddlepaddle/paddle:dev-000000 to free up space.


Done, it's a very good way!

# Use the cached thirdparty package if the MD5 is mathes.
md5_content=$(cat \
${PWD}/cmake/external/*.cmake \
${PWD}/paddle/scripts/teamcity/pr_build.sh \
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe don't need this line anymore it we don't check-in pre-build.sh to our repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


# Use the cached thirdparty package if the MD5 is mathes.
md5_content=$(cat \
${PWD}/cmake/external/*.cmake \
Copy link
Contributor

Choose a reason for hiding this comment

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

Smart!


# Do not build dev image for now

if [[ "%WITH_UBUNTU_MIRROR%" == "ON" ]]; then
Copy link
Contributor

@helinwang helinwang Mar 21, 2018

Choose a reason for hiding this comment

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

Does it make sense to tag the docker image with the hash of the Dockerfile? (and remove all other tags when a PR builds)
E.g.,
docker image:
paddlepaddle/paddle:dev-000000
paddlepaddle/paddle:dev-000001

If the hash is 000001, then use paddlepaddle/paddle:dev-000001 and remove paddlepaddle/paddle:dev-000000 to free up space.


Done, it's a very good way!

helinwang
helinwang previously approved these changes Mar 21, 2018
Copy link
Contributor

@helinwang helinwang left a comment

Choose a reason for hiding this comment

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

LGTM!!!

@@ -156,7 +156,8 @@ if(WITH_DISTRIBUTE)
set_source_files_properties(recv_op.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS})
op_library(listen_and_serv_op DEPS ${DISTRIBUTE_DEPS})
set_source_files_properties(listen_and_serv_op.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS})
cc_test(test_send_recv SRCS send_recv_op_test.cc DEPS send_op listen_and_serv_op sum_op executor)
# FIXME(Yancey1989): fix unit test
# cc_test(test_send_recv SRCS send_recv_op_test.cc DEPS send_op listen_and_serv_op sum_op executor)
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to separate this to another PR next time :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, and I add some comments at #9046 (comment), there are still some bugs while building with WITH_DISTRIBUTE=ON.

@@ -21,6 +21,8 @@
import os, sys
import time

sys.exit(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a TODO here, otherwise it's possible to forget.


dev_image_id=$(docker images paddlepaddle/paddle-dev:${md5_dev_dockerfile} -q)
if [[ ${dev_image_id} == "" ]]; then
docker rmi $(docker images paddlepaddle/paddle-dev -q) || true
Copy link
Contributor

Choose a reason for hiding this comment

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

Smart of using paddlepaddle/paddle-dev!

@Yancey1989
Copy link
Contributor Author

Yancey1989 commented Mar 22, 2018

Thanks for @helinwang and @typhoonzero 's reviewing, I moved the build script to the wiki page: https://github.com/PaddlePaddle/Paddle/wiki/PaddlePaddle-CI-Build-Scripts.

@helinwang
Copy link
Contributor

Thank you!!!

@Yancey1989 Yancey1989 changed the title Cache thirdparty pacakge on CI system [DONOT MERGE]Cache thirdparty pacakge on CI system, TEST CI Mar 30, 2018
@Yancey1989 Yancey1989 closed this Apr 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants