Skip to content

Commit 2b93c78

Browse files
authored
Ensure pypi setup is correct for publishing wheels through ngcsdk (#1563)
1 parent adbdc47 commit 2b93c78

File tree

4 files changed

+32
-18
lines changed

4 files changed

+32
-18
lines changed

.github/workflows/perform-release.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,6 @@ jobs:
311311
- name: Install Python dependencies
312312
run: pip install ngcsdk pyyaml
313313

314-
- name: Verify NGC CLI
315-
run: ngc --version
316-
317314
- name: Update Helm README
318315
run: helm/update_helm_readme.sh
319316

@@ -331,6 +328,8 @@ jobs:
331328
helm dependency build helm/
332329
333330
- name: Publish chart to NGC
331+
env:
332+
NGC_CLI_API_KEY: ${{ secrets.NVIDIA_API_KEY }}
334333
run: |
335334
python ci/scripts/release_helm_chart.py \
336335
--org nvidian \

.github/workflows/release-helm.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ jobs:
6565
- name: Install Python dependencies
6666
run: pip install ngcsdk pyyaml
6767

68-
- name: Verify NGC CLI
69-
run: ngc --version
70-
7168
- name: Update Helm README
7269
run: helm/update_helm_readme.sh
7370

.github/workflows/reusable-pypi-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
path: ./dist
2323

2424
- name: Install twine
25-
run: pip install twine
25+
run: pip install 'twine>=6.1'
2626

2727
- name: Publish wheels to Artifactory
2828
env:

ci/scripts/release_helm_chart.py

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@
1010
-t nemo-llm
1111
-v 24.06
1212
-n nv-ingest
13+
14+
Requires: pip install ngcsdk pyyaml
15+
Env vars: NGC_CLI_API_KEY (required for publish)
1316
"""
1417

1518
import argparse
1619
import os
1720
import subprocess
21+
import sys
1822

1923
import yaml
2024

@@ -101,17 +105,13 @@ def main() -> None:
101105
shell=True,
102106
)
103107

104-
# Update the version and chart name
105108
chart = yaml.safe_load(open(f"dist/{n}/Chart.yaml").read())
106109
chart["name"] = n
107110
chart["version"] = v
108111
with open(f"dist/{n}/Chart.yaml", "w") as f:
109112
f.write(yaml.safe_dump(chart))
110113

111-
# Update the README.md
112114
overview = f"dist/{n}/README.md"
113-
114-
ngc = "ngc registry chart"
115115
logo = args.logo_url if args.logo_url else LOGO
116116

117117
subprocess.check_call(f"helm package dist/{n}", shell=True)
@@ -120,15 +120,33 @@ def main() -> None:
120120
print(f"[DRY RUN] Chart packaged successfully: {n}-{v}.tgz")
121121
print(f"[DRY RUN] Skipping NGC chart update and push for {o}/{t}/{n}:{v}")
122122
else:
123-
subprocess.check_call(
124-
f"{ngc} update {o}/{t}/{n} --overview-filename {overview} --short-desc '{d}'"
125-
+ f" --logo '{logo}' --display-name '{dn}' --publisher NVIDIA",
126-
shell=True,
123+
api_key = os.environ.get("NGC_CLI_API_KEY", "")
124+
if not api_key:
125+
print("ERROR: NGC_CLI_API_KEY environment variable is not set", file=sys.stderr)
126+
sys.exit(1)
127+
128+
from ngcsdk import Client
129+
130+
clt = Client()
131+
clt.configure(api_key=api_key, org_name=o, team_name=t)
132+
133+
target = f"{o}/{t}/{n}"
134+
print(f"Updating chart metadata for {target} ...")
135+
clt.registry.chart.update(
136+
target=target,
137+
overview_filepath=overview,
138+
short_description=d,
139+
logo=logo,
140+
display_name=dn,
141+
publisher="NVIDIA",
127142
)
128-
subprocess.check_call(
129-
f"{ngc} push --org {o} --team {t} {o}/{t}/{n}:{v}",
130-
shell=True,
143+
144+
print(f"Pushing chart {target}:{v} ...")
145+
clt.registry.chart.push(
146+
target=f"{target}:{v}",
147+
source_dir=".",
131148
)
149+
print(f"Successfully pushed {target}:{v}")
132150

133151

134152
if __name__ == "__main__":

0 commit comments

Comments
 (0)