Skip to content

Commit c1feabe

Browse files
committed
Add repartition job
1 parent bebe168 commit c1feabe

File tree

2 files changed

+96
-4
lines changed

2 files changed

+96
-4
lines changed

ci/repartition-index.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Repartitioning runs on Azure Pipelines, because that's where we have SSH
2+
# access to the download server.
3+
4+
name: $(Date:yyyyMMdd).$(Rev:r)
5+
6+
# Do not run automatically
7+
trigger: none
8+
9+
10+
parameters:
11+
- name: Publish
12+
displayName: "Publish"
13+
type: boolean
14+
default: false
15+
- name: TestPublish
16+
displayName: "Run all steps without publishing"
17+
type: boolean
18+
default: false
19+
20+
stages:
21+
- stage: PyManagerIndexPartition
22+
displayName: 'Repartition PyManager Index'
23+
24+
jobs:
25+
- job: Repartition
26+
27+
pool:
28+
vmImage: 'windows-latest'
29+
30+
variables:
31+
- group: PythonOrgPublish
32+
33+
steps:
34+
- checkout: self
35+
36+
- task: NugetToolInstaller@0
37+
displayName: 'Install Nuget'
38+
39+
- powershell: |
40+
nuget install -o host_python -x -noninteractive -prerelease python
41+
Write-Host "##vso[task.prependpath]$(gi host_python\python\tools)"
42+
displayName: 'Install host Python'
43+
workingDirectory: $(Build.BinariesDirectory)
44+
45+
- powershell: |
46+
cd (mkdir -Force index)
47+
python "$(Build.SourcesDirectory)\scripts\repartition-index.py" --default-windows
48+
displayName: 'Repartition index'
49+
workingDirectory: $(Build.BinariesDirectory)
50+
51+
- publish: $(Build.BinariesDirectory)\index
52+
artifact: index
53+
displayName: Publish index artifact
54+
55+
- ${{ if or(eq(parameters.Publish, 'true'), eq(parameters.TestPublish, 'true')) }}:
56+
- ${{ if ne(parameters.TestPublish, 'true') }}:
57+
- task: DownloadSecureFile@1
58+
name: sshkey
59+
inputs:
60+
secureFile: pydotorg-ssh.ppk
61+
displayName: 'Download PuTTY key'
62+
63+
- powershell: |
64+
git clone https://github.com/python/cpython-bin-deps --branch putty --single-branch --depth 1 --progress -v "putty"
65+
"##vso[task.prependpath]$(gi putty)"
66+
workingDirectory: $(Pipeline.Workspace)
67+
displayName: 'Download PuTTY binaries'
68+
69+
- powershell: |
70+
dir *.json | %{
71+
pscp -batch -hostkey $env:UPLOAD_HOST_KEY -noagent -i $env:UPLOAD_KEYFILE `
72+
$_ "${env:UPLOAD_USER}@${env:UPLOAD_HOST}:/srv/www.python.org/ftp/python/$($_.Name)"
73+
plink -batch -hostkey $env:UPLOAD_HOST_KEY
74+
}
75+
displayName: 'Publish packages'
76+
env:
77+
UPLOAD_URL: $(PyDotOrgUrlPrefix)python/pymanager
78+
UPLOAD_DIR: $(DIST_DIR)
79+
UPLOAD_URL_PREFIX: $(PyDotOrgUrlPrefix)
80+
UPLOAD_PATH_PREFIX: $(PyDotOrgUploadPathPrefix)
81+
UPLOAD_HOST: $(PyDotOrgServer)
82+
UPLOAD_HOST_KEY: $(PyDotOrgHostKey)
83+
UPLOAD_USER: $(PyDotOrgUsername)
84+
${{ if eq(parameters.TestPublish, 'true') }}:
85+
NO_UPLOAD: 1
86+
${{ else }}:
87+
UPLOAD_KEYFILE: $(sshkey.secureFilePath)

ci/upload.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
UPLOAD_PATH_PREFIX = os.getenv("UPLOAD_PATH_PREFIX", "/srv/www.python.org/ftp/")
1010
UPLOAD_URL = os.getenv("UPLOAD_URL")
1111
UPLOAD_DIR = os.getenv("UPLOAD_DIR")
12-
# A version will be inserted before the extension later on
13-
MANIFEST_FILE = os.getenv("MANIFEST_FILE")
1412
UPLOAD_HOST = os.getenv("UPLOAD_HOST", "")
1513
UPLOAD_HOST_KEY = os.getenv("UPLOAD_HOST_KEY", "")
1614
UPLOAD_KEYFILE = os.getenv("UPLOAD_KEYFILE", "")
1715
UPLOAD_USER = os.getenv("UPLOAD_USER", "")
1816
NO_UPLOAD = os.getenv("NO_UPLOAD", "no")[:1].lower() in "yt1"
1917

18+
UPLOADING_INDEX = os.getenv("UPLOADING_INDEX", "no")[:1].lower() in "yt1"
19+
2020

2121
if not UPLOAD_URL:
2222
print("##[error]Cannot upload without UPLOAD_URL")
@@ -179,10 +179,15 @@ def purge(url):
179179

180180
UPLOADS = []
181181

182-
for pat in ("python-manager-*.msix", "python-manager-*.msi", "pymanager.appinstaller"):
183-
for f in UPLOAD_DIR.glob(pat):
182+
if UPLOADING_INDEX:
183+
for f in UPLOAD_DIR.glob("*.json"):
184184
u = UPLOAD_URL + f.name
185185
UPLOADS.append((f, u, url2path(u)))
186+
else:
187+
for pat in ("python-manager-*.msix", "python-manager-*.msi", "pymanager.appinstaller"):
188+
for f in UPLOAD_DIR.glob(pat):
189+
u = UPLOAD_URL + f.name
190+
UPLOADS.append((f, u, url2path(u)))
186191

187192
print("Planned uploads:")
188193
for f, u, p in UPLOADS:

0 commit comments

Comments
 (0)