Skip to content

Instantly share code, notes, and snippets.

@echohack
Last active December 17, 2015 20:09
Show Gist options
  • Save echohack/5665039 to your computer and use it in GitHub Desktop.
Save echohack/5665039 to your computer and use it in GitHub Desktop.
Artifactory Secret Build Info API.
def create_build_info(self, build_name, build_number, dependencies, build_dependencies):
"""
Returns a build info dictionary which is formated to correctly deploy
a new build to artifactory.
Make a put request with this build info to api/build
"""
build_info = {'version': '1.0.1',
'name': build_name,
'number': str(build_number),
'type': 'GENERIC',
'buildAgent': {'name': 'python', 'version': 'python'},
'agent': {'name': 'yourAgentName', 'version': 'yourAgentVersion'},
'started': datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S.000-0000'),
'durationMillis': 0,
'principal': self.build_name,
'artifactoryPrincipal': self.username,
'url': 'http://yourciserver/job/{}/{}'.format(self.build_name, self.build_number),
'licenseControl': {
'runChecks': False,
'includePublishedArtifacts': False,
'autoDiscover': False,
'licenseViolationsRecipientsList': '',
'scopesList': ''},
'buildRetention': {
'count': -1,
'deleteBuildArtifacts': True,
'buildNumbersNotToBeDiscarded': []},
'modules': [{
'id': '{}:{}'.format(build_name, build_number),
'artifacts': dependencies,
'dependencies': []}],
'buildDependencies': build_dependencies}
return build_info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment