Eric27710
Eric27710

Reputation: 137

How to upload a GitLab project export to AWS S3 bucket using python-gitlab package

I am having issues trying to export/upload a GitLab project to AWS S3 using the following code that uses the Python python-gitlab package:

import gitlab

gl = gitlab.GitLab(url=<my_server>, private_token=<my_gitlab_token>, ssl_verify=False)
gl.auth()

project = gl.projects.get('545')
project.exports.create(
     {
         "upload":
              {
                 "url": "https://<s3_bucket>/", "method": "POST"
              }
     {
)

No errors are reported, but the exported project is not there if I check the S3 bucket. This bucket has encryption turned on, so I'm guessing the issue is that a KMS key needs to be passed to this function, but I'm unsure how to do this.

I have successfully uploaded a dummy file to the same S3 bucket using the boto3 package:

s3_client_upload("myfile.text", <S3_bucket>, <S3_bucket_key>, ExtraArgs={'ServerSideEncryption': 'aws:kms', 'SSEKMSKeyID':'<S3_encryption_key>})

Thanks for any help!

Upvotes: 0

Views: 71

Answers (0)

Related Questions