How to manage versions using jenkins and API

Solved!
arielma2304
Level 3
How to manage versions using jenkins and API

Hi

I created similar pipeline to what present here:
Building-a-Jenkins-pipeline-for-Dataiku-DSS

My question is: Assuming I want each build to update the DSS project description with the jenkins build number (for managing versions and roll back later) , how it can be done?

I saw that for export_bundle function, we don't have such argument

project.py

alternatively, does the DSS project description can pull such information from the bundles list using markdown? In the below link I see we can link it to DSS objects, but bundles are not part of this:

link-to-dss-object

0 Kudos
1 Solution
fsergot
Dataiker

Hello,

If you want to update the project description, you need to do that with the project object and, more precisely, with its metadata (see dataiku python client ). You can do this update manually on each instance once the bundle is activated or before creating the bundle so that this information is embeded in it.
Here is an example of code doing that (note that there are 2 description fields for a project, a short and a long, I am putting the code for both here):

import dataikuapi
import pprint

pp = pprint.PrettyPrinter()

client = dataikuapi.DSSClient("http://localhost:13000/", "ABC")
project = client.get_project("DKU_TSHIRTS")
pmeta = project.get_metadata()
print('-------------')
print(pmeta['description'])
print(pmeta['shortDesc'])
print('-------------')
print(" -->Updating")
pmeta['description'] = 'This is a desc'
pmeta['shortDesc'] = 'This is a short desc'
print('-------------')
print(pmeta['description'])
print(pmeta['shortDesc'])
print('-------------')
project.set_metadata(pmeta)

As for markdown linking to bundles, it is indeed not possible in markdown. The Markdown support is conceived for collaboration and bundles are more technical plumbing so are not mentioned here (although we might add it in the future).

View solution in original post

1 Reply
fsergot
Dataiker

Hello,

If you want to update the project description, you need to do that with the project object and, more precisely, with its metadata (see dataiku python client ). You can do this update manually on each instance once the bundle is activated or before creating the bundle so that this information is embeded in it.
Here is an example of code doing that (note that there are 2 description fields for a project, a short and a long, I am putting the code for both here):

import dataikuapi
import pprint

pp = pprint.PrettyPrinter()

client = dataikuapi.DSSClient("http://localhost:13000/", "ABC")
project = client.get_project("DKU_TSHIRTS")
pmeta = project.get_metadata()
print('-------------')
print(pmeta['description'])
print(pmeta['shortDesc'])
print('-------------')
print(" -->Updating")
pmeta['description'] = 'This is a desc'
pmeta['shortDesc'] = 'This is a short desc'
print('-------------')
print(pmeta['description'])
print(pmeta['shortDesc'])
print('-------------')
project.set_metadata(pmeta)

As for markdown linking to bundles, it is indeed not possible in markdown. The Markdown support is conceived for collaboration and bundles are more technical plumbing so are not mentioned here (although we might add it in the future).