CICD Project Deployment

ben_engel
Level 1
CICD Project Deployment

Hi there, I'm trying to connect DSS to gitlab cicd to upload exported projects automatically.

But I get a wired bug. In core it boils down to the question how to use import_bundle_from_stream.

Below you'll see my deploy script. What kind of stream expect the method? I'm using an full access api key.

import os
import dataikuapi

api_key = os.environ['APIKEY']
bundle = os.environ['DATAIKUBUNDLE']
url = os.environ['DATAIKUURL']

client = dataikuapi.DSSClient(host=url, api_key=api_key)
#new_project = client.create_project('TEST_PROJECT', 'test project', 'tester', description='a simple description')
project = client.get_project('BASKETBALLv2')
with open(os.path.join('demos',bundle), 'rb') as bundle_stream:
project.import_bundle_from_stream(bundle_stream)

Error log:

$ python deploy.sh
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/dataikuapi/dssclient.py", line 854, in _perform_http
    http_res.raise_for_status()
  File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: http://XXXXXXX/dip/publicapi/projects/BASKETBALLv2/bundles/imported/actions/importFromStream

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "deploy.sh", line 12, in <module>
    project.import_bundle_from_stream(bundle_stream)
  File "/usr/local/lib/python3.6/site-packages/dataikuapi/dss/project.py", line 633, in import_bundle_from_stream
    files=files)
  File "/usr/local/lib/python3.6/site-packages/dataikuapi/dssclient.py", line 864, in _perform_empty
    self._perform_http(method, path, params=params, body=body, files=files, stream=False, raw_body=raw_body)
  File "/usr/local/lib/python3.6/site-packages/dataikuapi/dssclient.py", line 861, in _perform_http
    raise DataikuException("%s: %s" % (ex.get("errorType", "Unknown error"), ex.get("message", "No message")))
dataikuapi.utils.DataikuException: com.dataiku.dip.exceptions.UnauthorizedException: Failed to read project permissions
section_end:1582238860:build_script
section_start:1582238860:after_script
section_end:1582238861:after_script
section_start:1582238861:upload_artifacts_on_failure
section_end:1582238863:upload_artifacts_on_failure
ERROR: Job failed: exit code 1


 

0 Kudos
1 Reply
Young-Sang_Lee
Dataiker

Hi Ben.

Can you clarify what you want to do?
Which node are you importing the project? Design or Automation?
Which file do you have with you? Bundle zip file or the project export zip file?

0 Kudos