Commit e328e268 authored by Stéphane Veyret's avatar Stéphane Veyret
Browse files

[fix] Update artifact links

parent c7ddd4b3
......@@ -33,5 +33,5 @@ class BinArtifact(Artifact):
return FSItemSize(int(os.path.getsize(self.file_name)))
def _build_url(self):
return '{}/-/jobs/artifacts/{}/raw/{}?job={}'.format(
os.environ['CI_PROJECT_URL'], self.tag, self.file_name, self.job)
return '{}/-/jobs/{}/artifacts/raw/{}'.format(
os.environ['CI_PROJECT_URL'], self.job, self.file_name)
import json
import os
import urllib.request
from projectapi import ProjectApi
class Pipeline(ProjectApi):
'''
Pipeline data API.
'''
def __init__(self):
ProjectApi.__init__(self, '/pipelines/{}'.format(os.environ['CI_PIPELINE_ID']))
def find_job_id(self, job_name):
'''
Find the id corresponding to given job name in the pipeline.
:param job_name: The job name.
:type job_name: str
:return: The identifier.
:rtype: int
'''
request = self.build_request('/jobs')
response = urllib.request.urlopen(request)
response_data = response.read().decode()
for job in json.loads(response_data):
if job['name'] == job_name: return job['id']
print('CRITICAL No job with given name {} found'.format(job_name))
exit(1)
......@@ -5,7 +5,6 @@ import os
from binartifact import BinArtifact
from job import Job
from pipeline import Pipeline
from placeholder import PlaceHolder
from releasenote import ReleaseNote
from releasewikipage import ReleaseWikiPage
......@@ -91,7 +90,6 @@ class Releaser:
for artifact in self._get_bin_artifacts():
if not artifact.job in jobs:
jobs.append(artifact.job)
jobs = map(lambda j: Pipeline().find_job_id(j), jobs)
for job_id in jobs: Job(job_id).keep_artifacts()
print('Release published')
......
......@@ -59,7 +59,7 @@ create_desc() {
cat >"${1}".desc <<-EOF
{
"version": "${DUNITER_TAG}",
"job": "${CI_JOB_NAME}",
"job": "${CI_JOB_ID}",
"type": "${2^}",
"category": "${3}",
"arch": "x64"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment