简体   繁体   中英

how can we get contents of a buildspec.yml file from each codebuild project through Boto3 API

I am not able to find out any function which can get the content of buildspec.yml file. what i have been able to do so far is list all the projects in my AWS account

"`"

client = boto3.client('codebuild')  
response = client.batch_get_projects(
    names=[
        'ABC',
        'XYZ'     
    ]
)  
  for i in response['projects']:
    for key,value in i.items():
      if key in ("name","source"):
        print(key, value)

output - 
name ABC
source {'type': 'CODEPIPELINE', 'buildspec': 'buildspec.yml', 'insecureSsl': False}
name XYZ
source {'type': 'CODEPIPELINE', 'buildspec': 'buildspec.yml', 'insecureSsl': False}

It will be stored in your build artifact . Usually those artifacts are store in S3 for your pipeline. Thus you have to develop the program who gets the files from S3. The artifacts will be zipped, so you have to extract them as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM