Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipelines: optionally provide access to the environment configuration for the self mutate stage #15279

Closed
mrpackethead opened this issue Jun 23, 2021 · 6 comments
Labels
@aws-cdk/pipelines CDK Pipelines library effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1

Comments

@mrpackethead
Copy link

Currently there is no exposed method for modifying the environment of the self mutate stage. In my use-case of pipeline i need to allow the self-mutate codebuild to run in privldiged mode. This is because my source stages use lambdas that are based on docker backed executables. ( in particuallar i do this so i can have a native integration with AzureDevops. )... I also set the compute_type to LARGE rather than SMALL as this improves the build times.. (

I currently do this by using escape hatches to set the Environment of the SelfMutation

mutating_codebuild = self.pipeline.node.find_child(id ='UpdatePipeline')
            codebuild_project = mutating_codebuild.node.find_child(id ='SelfMutation')
            raw_code_build = codebuild_project.node.default_child    
            raw_code_build.add_override("Properties.Environment.PrivilegedMode", "True")
            raw_code_build.add_override("Properties.Environment.ComputeType", compute_type[pipeline_synth_cfg['Environment']['ComputeType']])

I would propose creating something similar to pipelines.SimpleSynthAction , perhaps pipelines.SimpleMutateAction, which could be optionally added to the cdkpipeline.. There may be a case for providing a way to pass build/install commands similar to the simple synth..



mutate_action = pipelines.SimpleMutateAction(
            environment = codebuild.BuildEnvironment(
                build_image = typing.cast(codebuild.IBuildImage, codebuild.LinuxBuildImage.AMAZON_LINUX_2_3),
                privileged = pipeline_synth_cfg['Environment']['Privileged'],
                compute_type = codebuild.ComputeType(pipeline_synth_cfg['Environment']['ComputeType'])
            )
            ]
        )

 # Create the Pipeline
        self.pipeline = pipelines.CdkPipeline(self, project_name + 'cdkPipeline',
            cloud_assembly_artifact = cloud_assembly_artifact,
            pipeline_name = f'{project_name}pipeline',
            source_action = pipeline_source_action,
            synth_action = synth_action,
           mutate_action = mutate_action       #  Add this here. 
            self_mutating = pipeline_cfg['Pipeline']['SelfMutate']
        )
@mrpackethead mrpackethead added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jun 23, 2021
@github-actions github-actions bot added the @aws-cdk/pipelines CDK Pipelines library label Jun 23, 2021
@rix0rrr
Copy link
Contributor

rix0rrr commented Jun 28, 2021

Would be addressed by #15169

@rix0rrr rix0rrr added effort/medium Medium work item – several days of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Jun 28, 2021
@rix0rrr rix0rrr removed their assignment Jun 28, 2021
@hoegertn
Copy link
Contributor

As #15169 only touches the BuildSpec I will implement this in a separate PR to not mix too many things.

@hoegertn
Copy link
Contributor

I think the specific use case mentioned in this issue is already possible with the supportDockerAssets option of the pipeline.

@mrpackethead can you test if this solves the problem?

@mrpackethead
Copy link
Author

mrpackethead commented Jul 13, 2021

Not sure if i missed that when i first setup my pipelines or if supportDockerAssets has been added in subsequent versions.. For that specific issue, it would resolve the issue and makes the container run in a prividlged mode ( so docker can run ). However it doestn allow me to adjust the other parameters of the environment ( such as size )..

Additinally ( a new want/requirement ) is that i want to specifiy the images that both the synth and update codebuilds will use, so that they use pre-canned images with all our dependancies already installed to speed up pipeline times..

@mrpackethead
Copy link
Author

I think all of this is addressed with the migration to the new cdk pipeline api

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/pipelines CDK Pipelines library effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p1
Projects
None yet
Development

No branches or pull requests

3 participants