Skip to content
Snippets Groups Projects
Commit 7d327095 authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Automate registration of conda build artifacts to GitLab

parent b24dc03f
No related branches found
No related tags found
No related merge requests found
......@@ -5,5 +5,6 @@
# build and conda-build artifacts
build/*
conda-bld/*
dist/*
*.egg-info/*
\ No newline at end of file
"""
Automate registration of conda build artifacts to EMBL GitLab;
assumes API access token is recorded in ~/.pypirc shell configuration file
"""
from configparser import ConfigParser
import json
from pathlib import Path
import requests
id = '5668'
proj = 'model_server'
root = Path('../conda-bld/')
# get authentication info from local config file
cfg = ConfigParser()
cfg.read(Path.home() / '.pypirc')
user = cfg['gitlab-model-server']['username']
pwd = cfg['gitlab-model-server']['password']
with open(root / 'channeldata.json', 'r') as fh:
chdata = json.load(fh)
# upload to GitLab API
res = []
for sd in ['noarch', 'win-64']:
with open(root / sd / 'repodata.json', 'r') as fh:
dd = json.load(fh)
for fn in dd['packages'].keys():
ver = dd['packages'][fn]['version']
stem = fn.split('.tar.bz2')[0]
pkgname = f'conda_{sd}_{stem}'
res.append(
requests.put(
f'https://git.embl.de/api/v4/projects/{id}/packages/generic/{pkgname}/{ver}/{fn}?status=default',
headers={'PRIVATE-TOKEN': pwd},
)
)
print('Finished')
print(res)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment