Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit 135f23c

Browse files
authored
Parameterize UPLOAD_CHANNEL (#1037)
1 parent 0ffbfb3 commit 135f23c

File tree

3 files changed

+38
-14
lines changed

3 files changed

+38
-14
lines changed

.circleci/config.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ commands:
2525
command: |
2626
our_upload_channel=nightly
2727
# On tags upload to test instead
28-
if [[ -n "${CIRCLE_TAG}" ]]; then
28+
if [[ -n "${CIRCLE_TAG}" ]] || [[ ${CIRCLE_BRANCH} =~ release/* ]]; then
2929
our_upload_channel=test
3030
fi
3131
echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV}
@@ -75,6 +75,7 @@ jobs:
7575
resource_class: 2xlarge+
7676
steps:
7777
- checkout
78+
- designate_upload_channel
7879
- run: packaging/build_wheel.sh
7980
- store_artifacts:
8081
path: dist
@@ -90,6 +91,7 @@ jobs:
9091
resource_class: 2xlarge+
9192
steps:
9293
- checkout
94+
- designate_upload_channel
9395
- run: packaging/build_conda.sh
9496
- store_artifacts:
9597
path: /opt/conda/conda-bld/linux-64
@@ -104,6 +106,7 @@ jobs:
104106
name: windows-cpu
105107
steps:
106108
- checkout
109+
- designate_upload_channel
107110
- run:
108111
name: build
109112
command: |
@@ -123,6 +126,7 @@ jobs:
123126
name: windows-cpu
124127
steps:
125128
- checkout
129+
- designate_upload_channel
126130
- run:
127131
name: build
128132
command: |
@@ -144,6 +148,7 @@ jobs:
144148
xcode: "9.4.1"
145149
steps:
146150
- checkout
151+
- designate_upload_channel
147152
- run:
148153
# Installing cmake with `brew install cmake` takes 30 mins, so we use binary distribution.
149154
command: |
@@ -169,6 +174,7 @@ jobs:
169174
xcode: "9.4.1"
170175
steps:
171176
- checkout
177+
- designate_upload_channel
172178
- run:
173179
command: |
174180
curl -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
@@ -196,7 +202,7 @@ jobs:
196202
# Prevent credential from leaking
197203
conda install -yq anaconda-client
198204
set -x
199-
anaconda -t "${CONDA_PYTORCHBOT_TOKEN}" upload ~/workspace/conda-bld/*/*.tar.bz2 -u pytorch-nightly --label main --no-progress --force
205+
anaconda -t "${CONDA_PYTORCHBOT_TOKEN}" upload ~/workspace/conda-bld/*/*.tar.bz2 -u "pytorch-${UPLOAD_CHANNEL}" --label main --no-progress --force
200206
201207
# Requires org-member context
202208
binary_wheel_upload:
@@ -217,7 +223,7 @@ jobs:
217223
export AWS_SECRET_ACCESS_KEY="${PYTORCH_BINARY_AWS_SECRET_ACCESS_KEY}"
218224
set -x
219225
for pkg in ~/workspace/*.whl; do
220-
aws s3 cp "$pkg" "s3://pytorch/whl/nightly/" --acl public-read
226+
aws s3 cp "$pkg" "s3://pytorch/whl/${UPLOAD_CHANNEL}/" --acl public-read
221227
done
222228
223229
smoke_test_linux_conda:
@@ -244,12 +250,13 @@ jobs:
244250
steps:
245251
- attach_workspace:
246252
at: ~/workspace
253+
- designate_upload_channel
247254
- run:
248255
name: install binaries
249256
command: |
250257
set -x
251258
source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION}
252-
pip install $(ls ~/workspace/torchtext*.whl) --pre -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
259+
pip install $(ls ~/workspace/torchtext*.whl) --pre -f "https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu/torch_${UPLOAD_CHANNEL}.html"
253260
- run:
254261
name: smoke test
255262
command: |
@@ -283,6 +290,7 @@ jobs:
283290
steps:
284291
- attach_workspace:
285292
at: ~/workspace
293+
- designate_upload_channel
286294
- run:
287295
name: install binaries
288296
command: |
@@ -291,7 +299,7 @@ jobs:
291299
conda env remove -n python${PYTHON_VERSION} || true
292300
conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
293301
conda activate python${PYTHON_VERSION}
294-
conda install -v -y -c pytorch-nightly pytorch
302+
conda install -v -y -c pytorch-"${UPLOAD_CHANNEL}" pytorch
295303
conda install -v -y -c ~/workspace/conda-bld torchtext
296304
- run:
297305
name: smoke test
@@ -307,6 +315,7 @@ jobs:
307315
steps:
308316
- attach_workspace:
309317
at: ~/workspace
318+
- designate_upload_channel
310319
- run:
311320
name: install binaries
312321
command: |
@@ -315,7 +324,7 @@ jobs:
315324
conda env remove -n python${PYTHON_VERSION} || true
316325
conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
317326
conda activate python${PYTHON_VERSION}
318-
pip install $(ls ~/workspace/torchtext*.whl) --pre -f https://download.pytorch.org/whl/nightly/torch_nightly.html
327+
pip install $(ls ~/workspace/torchtext*.whl) --pre -f "https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/torch_${UPLOAD_CHANNEL}.html"
319328
- run:
320329
name: smoke test
321330
command: |
@@ -330,6 +339,7 @@ jobs:
330339
resource_class: 2xlarge+
331340
steps:
332341
- checkout
342+
- designate_upload_channel
333343
- run:
334344
name: Generate cache key
335345
# This will refresh cache on Sundays, nightly build should generate new cache.
@@ -381,6 +391,7 @@ jobs:
381391
name: windows-cpu
382392
steps:
383393
- checkout
394+
- designate_upload_channel
384395
- run:
385396
name: Generate cache key
386397
# This will refresh cache on Sundays, nightly build should generate new cache.
@@ -433,6 +444,7 @@ jobs:
433444
resource_class: medium
434445
steps:
435446
- checkout
447+
- designate_upload_channel
436448
- run:
437449
name: Generate cache key
438450
# This will refresh cache on Sundays, nightly build should generate new cache.

.circleci/config.yml.in

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ commands:
2525
command: |
2626
our_upload_channel=nightly
2727
# On tags upload to test instead
28-
if [[ -n "${CIRCLE_TAG}" ]]; then
28+
if [[ -n "${CIRCLE_TAG}" ]] || [[ ${CIRCLE_BRANCH} =~ release/* ]]; then
2929
our_upload_channel=test
3030
fi
3131
echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV}
@@ -75,6 +75,7 @@ jobs:
7575
resource_class: 2xlarge+
7676
steps:
7777
- checkout
78+
- designate_upload_channel
7879
- run: packaging/build_wheel.sh
7980
- store_artifacts:
8081
path: dist
@@ -90,6 +91,7 @@ jobs:
9091
resource_class: 2xlarge+
9192
steps:
9293
- checkout
94+
- designate_upload_channel
9395
- run: packaging/build_conda.sh
9496
- store_artifacts:
9597
path: /opt/conda/conda-bld/linux-64
@@ -104,6 +106,7 @@ jobs:
104106
name: windows-cpu
105107
steps:
106108
- checkout
109+
- designate_upload_channel
107110
- run:
108111
name: build
109112
command: |
@@ -123,6 +126,7 @@ jobs:
123126
name: windows-cpu
124127
steps:
125128
- checkout
129+
- designate_upload_channel
126130
- run:
127131
name: build
128132
command: |
@@ -144,6 +148,7 @@ jobs:
144148
xcode: "9.4.1"
145149
steps:
146150
- checkout
151+
- designate_upload_channel
147152
- run:
148153
# Installing cmake with `brew install cmake` takes 30 mins, so we use binary distribution.
149154
command: |
@@ -169,6 +174,7 @@ jobs:
169174
xcode: "9.4.1"
170175
steps:
171176
- checkout
177+
- designate_upload_channel
172178
- run:
173179
command: |
174180
curl -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
@@ -196,7 +202,7 @@ jobs:
196202
# Prevent credential from leaking
197203
conda install -yq anaconda-client
198204
set -x
199-
anaconda -t "${CONDA_PYTORCHBOT_TOKEN}" upload ~/workspace/conda-bld/*/*.tar.bz2 -u pytorch-nightly --label main --no-progress --force
205+
anaconda -t "${CONDA_PYTORCHBOT_TOKEN}" upload ~/workspace/conda-bld/*/*.tar.bz2 -u "pytorch-${UPLOAD_CHANNEL}" --label main --no-progress --force
200206

201207
# Requires org-member context
202208
binary_wheel_upload:
@@ -217,7 +223,7 @@ jobs:
217223
export AWS_SECRET_ACCESS_KEY="${PYTORCH_BINARY_AWS_SECRET_ACCESS_KEY}"
218224
set -x
219225
for pkg in ~/workspace/*.whl; do
220-
aws s3 cp "$pkg" "s3://pytorch/whl/nightly/" --acl public-read
226+
aws s3 cp "$pkg" "s3://pytorch/whl/${UPLOAD_CHANNEL}/" --acl public-read
221227
done
222228

223229
smoke_test_linux_conda:
@@ -244,12 +250,13 @@ jobs:
244250
steps:
245251
- attach_workspace:
246252
at: ~/workspace
253+
- designate_upload_channel
247254
- run:
248255
name: install binaries
249256
command: |
250257
set -x
251258
source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION}
252-
pip install $(ls ~/workspace/torchtext*.whl) --pre -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
259+
pip install $(ls ~/workspace/torchtext*.whl) --pre -f "https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/cpu/torch_${UPLOAD_CHANNEL}.html"
253260
- run:
254261
name: smoke test
255262
command: |
@@ -283,6 +290,7 @@ jobs:
283290
steps:
284291
- attach_workspace:
285292
at: ~/workspace
293+
- designate_upload_channel
286294
- run:
287295
name: install binaries
288296
command: |
@@ -291,7 +299,7 @@ jobs:
291299
conda env remove -n python${PYTHON_VERSION} || true
292300
conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
293301
conda activate python${PYTHON_VERSION}
294-
conda install -v -y -c pytorch-nightly pytorch
302+
conda install -v -y -c pytorch-"${UPLOAD_CHANNEL}" pytorch
295303
conda install -v -y -c ~/workspace/conda-bld torchtext
296304
- run:
297305
name: smoke test
@@ -307,6 +315,7 @@ jobs:
307315
steps:
308316
- attach_workspace:
309317
at: ~/workspace
318+
- designate_upload_channel
310319
- run:
311320
name: install binaries
312321
command: |
@@ -315,7 +324,7 @@ jobs:
315324
conda env remove -n python${PYTHON_VERSION} || true
316325
conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
317326
conda activate python${PYTHON_VERSION}
318-
pip install $(ls ~/workspace/torchtext*.whl) --pre -f https://download.pytorch.org/whl/nightly/torch_nightly.html
327+
pip install $(ls ~/workspace/torchtext*.whl) --pre -f "https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/torch_${UPLOAD_CHANNEL}.html"
319328
- run:
320329
name: smoke test
321330
command: |
@@ -330,6 +339,7 @@ jobs:
330339
resource_class: 2xlarge+
331340
steps:
332341
- checkout
342+
- designate_upload_channel
333343
- run:
334344
name: Generate cache key
335345
# This will refresh cache on Sundays, nightly build should generate new cache.
@@ -381,6 +391,7 @@ jobs:
381391
name: windows-cpu
382392
steps:
383393
- checkout
394+
- designate_upload_channel
384395
- run:
385396
name: Generate cache key
386397
# This will refresh cache on Sundays, nightly build should generate new cache.
@@ -433,6 +444,7 @@ jobs:
433444
resource_class: medium
434445
steps:
435446
- checkout
447+
- designate_upload_channel
436448
- run:
437449
name: Generate cache key
438450
# This will refresh cache on Sundays, nightly build should generate new cache.

packaging/pkg_helpers.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ setup_pip_pytorch_version() {
173173
else
174174
pip_install "torch==$PYTORCH_VERSION$PYTORCH_VERSION_SUFFIX" \
175175
-f https://download.pytorch.org/whl/torch_stable.html \
176-
-f https://download.pytorch.org/whl/nightly/torch_nightly.html
176+
-f "https://download.pytorch.org/whl/${UPLOAD_CHANNEL}/torch_${UPLOAD_CHANNEL}.html"
177177
fi
178178
}
179179

@@ -186,7 +186,7 @@ setup_conda_pytorch_constraint() {
186186
export CONDA_CHANNEL_FLAGS="-c pytorch-nightly"
187187
export PYTORCH_VERSION="$(conda search --json 'pytorch[channel=pytorch-nightly]' | python -c "import sys, json, re; print(re.sub(r'\\+.*$', '', json.load(sys.stdin)['pytorch'][-1]['version']))")"
188188
else
189-
export CONDA_CHANNEL_FLAGS="-c pytorch -c pytorch-nightly"
189+
export CONDA_CHANNEL_FLAGS="-c pytorch -c pytorch-${UPLOAD_CHANNEL}"
190190
fi
191191
if [[ "$CU_VERSION" == cpu ]]; then
192192
export CONDA_PYTORCH_BUILD_CONSTRAINT="- pytorch==$PYTORCH_VERSION${PYTORCH_VERSION_SUFFIX}"

0 commit comments

Comments
 (0)