Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Commit 59562f3

Browse files
authored
MNT Only run upload to anaconda when both secrets are defined
MNT Only run upload to anaconda when both secrets are defined
2 parents e81c90e + 25d80c1 commit 59562f3

File tree

2 files changed

+20
-28
lines changed

2 files changed

+20
-28
lines changed

azure/posix.yml

+10-15
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,6 @@ jobs:
9999
displayName: 'Publish Test Results'
100100
condition: eq(variables['SKIP_BUILD'], 'false')
101101

102-
- bash: |
103-
echo "##vso[task.prependpath]$CONDA/bin"
104-
sudo chown -R $USER $CONDA
105-
displayName: Add conda to PATH
106-
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'))
107-
108-
- bash: conda install -q -y anaconda-client
109-
displayName: Install anaconda-client
110-
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'))
111-
112102
- bash: |
113103
set -e
114104
if [ "$BUILD_REASON" == "Schedule" ]; then
@@ -118,18 +108,23 @@ jobs:
118108
ANACONDA_ORG="scikit-learn-wheels-staging"
119109
TOKEN="$SCIKIT_LEARN_STAGING_UPLOAD_TOKEN"
120110
fi
121-
if [ "$TOKEN" == "" ]; then
122-
echo "##[warning] Could not find anaconda.org upload token in secret variables"
123-
fi
124111
echo "##vso[task.setvariable variable=TOKEN]$TOKEN"
125112
echo "##vso[task.setvariable variable=ANACONDA_ORG]$ANACONDA_ORG"
126113
displayName: Retrieve secret upload token
127-
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'))
114+
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'), variables['SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN'], variables['SCIKIT_LEARN_STAGING_UPLOAD_TOKEN'])
128115
env:
129116
# Secret variables need to mapped to env variables explicitly:
130117
SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN: $(SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN)
131118
SCIKIT_LEARN_STAGING_UPLOAD_TOKEN: $(SCIKIT_LEARN_STAGING_UPLOAD_TOKEN)
132119
120+
- bash: echo "##vso[task.prependpath]$CONDA/Scripts"
121+
displayName: Add conda to PATH
122+
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'), variables['TOKEN'])
123+
124+
- bash: conda install -q -y anaconda-client
125+
displayName: Install anaconda-client
126+
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'), variables['TOKEN'])
127+
133128
- bash: |
134129
set -e
135130
# The --force option forces a replacement if the remote file already
@@ -138,4 +133,4 @@ jobs:
138133
anaconda -t $TOKEN upload --force -u $ANACONDA_ORG wheelhouse/*.whl
139134
echo "PyPI-style index: https://pypi.anaconda.org/$ANACONDA_ORG/simple"
140135
displayName: Upload to anaconda.org (only if secret token is retrieved)
141-
condition: ne(variables['TOKEN'], '')
136+
condition: variables['TOKEN']

azure/windows.yml

+10-13
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,6 @@ jobs:
108108
displayName: 'Publish Test Results'
109109
condition: eq(variables['SKIP_BUILD'], 'false')
110110

111-
- bash: echo "##vso[task.prependpath]$CONDA/Scripts"
112-
displayName: Add conda to PATH
113-
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'))
114-
115-
- bash: conda install -q -y anaconda-client
116-
displayName: Install anaconda-client
117-
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'))
118-
119111
- bash: |
120112
set -e
121113
if [ "$BUILD_REASON" == "Schedule" ]; then
@@ -125,18 +117,23 @@ jobs:
125117
ANACONDA_ORG="scikit-learn-wheels-staging"
126118
TOKEN="$SCIKIT_LEARN_STAGING_UPLOAD_TOKEN"
127119
fi
128-
if [ "$TOKEN" == "" ]; then
129-
echo "##[warning] Could not find anaconda.org upload token in secret variables"
130-
fi
131120
echo "##vso[task.setvariable variable=TOKEN]$TOKEN"
132121
echo "##vso[task.setvariable variable=ANACONDA_ORG]$ANACONDA_ORG"
133122
displayName: Retrieve secret upload token
134-
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'))
123+
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'), variables['SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN'], variables['SCIKIT_LEARN_STAGING_UPLOAD_TOKEN'])
135124
env:
136125
# Secret variables need to mapped to env variables explicitly:
137126
SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN: $(SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN)
138127
SCIKIT_LEARN_STAGING_UPLOAD_TOKEN: $(SCIKIT_LEARN_STAGING_UPLOAD_TOKEN)
139128
129+
- bash: echo "##vso[task.prependpath]$CONDA/Scripts"
130+
displayName: Add conda to PATH
131+
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'), variables['TOKEN'])
132+
133+
- bash: conda install -q -y anaconda-client
134+
displayName: Install anaconda-client
135+
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'), variables['TOKEN'])
136+
140137
- bash: |
141138
set -e
142139
# The --force option forces a replacement if the remote file already
@@ -145,4 +142,4 @@ jobs:
145142
anaconda -t $TOKEN upload --force -u $ANACONDA_ORG scikit-learn/dist/scikit_learn-*.whl
146143
echo "PyPI-style index: https://pypi.anaconda.org/$ANACONDA_ORG/simple"
147144
displayName: Upload to anaconda.org (only if secret token is retrieved)
148-
condition: ne(variables['TOKEN'], '')
145+
condition: variables['TOKEN']

0 commit comments

Comments
 (0)