How to feed seed code to GitHub Repository from Sagemaker Projects Organization Template created with Service Catalog?

0

The objective is to replicate "MLOps template for model building, training, and deployment with third-party Git repositories using Jenkins" builtin Sagemaker Project template. I want to feed custom seed code to the Github repository each time a project is created using my organization custom template instead of the default seed code that the builtin template feeds.

I am able to create the custom template using service catalog but I could not find a solution for feeding the seed code to github repo. So, I decided to see how the built in project template is doing this and it is using resources from this bucket "s3://sagemaker-servicecatalog-seedcode-us-east-1/bootstrap/GitRepositorySeedCodeCheckinCodeBuildProject-v1.0.zip" but I could not access it. I am not sure how to achieve the objective?

1 Answer
0
Accepted Answer

You can download the seed package using awscli s3 cp <s3_uri> <target_path> or by using this URL: https://sagemaker-servicecatalog-seedcode-us-east-1.s3.amazonaws.com/bootstrap/GitRepositorySeedCodeCheckinCodeBuildProject-v1.0.zip

This .zip is used by CodeBuild that is called when the template is deployed (by a lambda mapped to a CFN custom component). If you take a look in the template you'll find a component named "SageMakerModelBuildSeedCodeCheckinProjectTriggerLambdaInvoker". You can find some env vars defined for this component like: SEEDCODE_BUCKET_NAME and SEEDCODE_BUCKET_KEY. These vars point to an S3 uri that has another .zip file with the content of the seed for the git repo. If you get the default values defined there you can re-create the URL and download the .zip file as well: https://sagemaker-servicecatalog-seedcode-us-east-1.s3.amazonaws.com/toolchain/model-building-workflow-jenkins-v1.0.zip

So, in the end, if you want to change the content that is pushed to the git repo, you can redefine these 2 vars and point to an S3 path that contains a .zip file you created.

Bonus: If you're a curious person, I recommend you to take a look at the .java file (src/main/java/GitRepositorySeedCodeBootStrapper.java) inside the .zip of the CodeBuild .zip for you to understand what it does to prepare the git repo like: download a .zip, unpack it, commit/push to the git repo.

AWS
answered 2 years ago
  • Thanks a lot !!!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions