-
-
Notifications
You must be signed in to change notification settings - Fork 176
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
use a script instead of piping to stdin in run_docker_build #337
Changes from all commits
e7e2053
97b5b51
7a79123
dac8e1e
4fc4957
7d18fff
762f420
bef0f87
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
*.pyc | ||
|
||
build_artifacts | ||
.circleci/build.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
# changes to this script, consider a proposal to conda-smithy so that other feedstocks can also | ||
# benefit from the improvement. | ||
|
||
set -e | ||
FEEDSTOCK_ROOT=$(cd "$(dirname "$0")/.."; pwd;) | ||
RECIPE_ROOT=$FEEDSTOCK_ROOT/{{ recipe_dir }} | ||
|
||
|
@@ -25,6 +26,7 @@ show_channel_urls: true | |
CONDARC | ||
) | ||
|
||
|
||
# In order for the conda-build process in the container to write to the mounted | ||
# volumes, we need to run with the same id as the host machine, which is | ||
# normally the owner of the mounted volumes, or at least has write permission | ||
|
@@ -37,19 +39,15 @@ fi | |
|
||
rm -f "$FEEDSTOCK_ROOT/build_artifacts/conda-forge-build-done" | ||
|
||
cat << EOF | {{ docker.executable }} run -i \ | ||
-v "${RECIPE_ROOT}":/home/conda/recipe_root \ | ||
-v "${FEEDSTOCK_ROOT}":/home/conda/feedstock_root \ | ||
-e CONFIG="$CONFIG" \ | ||
-e HOST_USER_ID="${HOST_USER_ID}" \ | ||
-a stdin -a stdout -a stderr \ | ||
{{ docker.image }} \ | ||
{{ docker.command }} || exit 1 | ||
ARTIFACTS="$FEEDSTOCK_ROOT/build_artifacts" | ||
|
||
test -d "$ARTIFACTS" || mkdir "$ARTIFACTS" | ||
DONE_CANARY="$ARTIFACTS/conda-forge-build-done" | ||
rm -f "$DONE_CANARY" | ||
|
||
cat << EOF > "$FEEDSTOCK_ROOT/.circleci/build.sh" | ||
|
||
set -e | ||
set +x | ||
export BINSTAR_TOKEN=${BINSTAR_TOKEN} | ||
set -x | ||
export PYTHONUNBUFFERED=1 | ||
|
||
echo "$config" > ~/.condarc | ||
|
@@ -60,17 +58,33 @@ conda install --yes --quiet conda-forge-ci-setup=1 | |
{% if build_setup -%} | ||
{{ build_setup }}{% endif -%} | ||
|
||
conda build /home/conda/recipe_root -m /home/conda/feedstock_root/.ci_support/${CONFIG}.yaml --quiet || exit 1 | ||
conda build /home/conda/recipe_root -m /home/conda/feedstock_root/.ci_support/${CONFIG}.yaml --quiet | ||
{%- for owner, channel in channels['targets'] %} | ||
{{ upload_script }} /home/conda/recipe_root {{ owner }} --channel={{ channel }} -m /home/conda/feedstock_root/.ci_support/${CONFIG}.yaml || exit 1 | ||
{{ upload_script }} /home/conda/recipe_root {{ owner }} --channel={{ channel }} -m /home/conda/feedstock_root/.ci_support/${CONFIG}.yaml | ||
{%- endfor %} | ||
|
||
touch /home/conda/feedstock_root/build_artifacts/conda-forge-build-done | ||
EOF | ||
|
||
# double-check that the build got to the end | ||
# see https://github.com/conda-forge/conda-smithy/pull/337 | ||
# for a possible fix | ||
set +x | ||
echo "BINSTAR_TOKEN=${BINSTAR_TOKEN}" > "${FEEDSTOCK_ROOT}/env" | ||
set -x | ||
test -f "$FEEDSTOCK_ROOT/build_artifacts/conda-forge-build-done" || exit 1 | ||
|
||
# Create and run the container in two commands, | ||
# so the token env isn't on disk too long | ||
|
||
CONTAINER=$(docker create -t \ | ||
-v "${RECIPE_ROOT}":/home/conda/recipe_root \ | ||
-v "${FEEDSTOCK_ROOT}":/home/conda/feedstock_root \ | ||
--env-file ${FEEDSTOCK_ROOT}/env \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was not aware of this option. Nice fix! |
||
-e HOST_USER_ID="${HOST_USER_ID}" \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You've missed the CONFIG env variable here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
{{ docker.image }} \ | ||
{{ docker.command }} \ | ||
/home/conda/feedstock_root/.circleci/build.sh || exit $?) | ||
|
||
rm "${FEEDSTOCK_ROOT}/env" | ||
# do it | ||
docker start -i $CONTAINER | ||
|
||
# verify that the end of the script was reached | ||
test -f "$DONE_CANARY" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put this inside .circleci folder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually would it make sense to save this in a directory that is not mounted in the container? To propose an arbitrary option, what about
~/.conda-smithy/upload.token
?