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

[cdk-pipelines] CodeArtifact connectivity from docker bundling container #9942

Closed
srethira opened this issue Aug 24, 2020 · 3 comments
Closed
Labels
@aws-cdk/pipelines CDK Pipelines library guidance Question that needs advice or information.

Comments

@srethira
Copy link

srethira commented Aug 24, 2020

❓ General Issue

We are doing asset bundling using a docker container. It is pulling packages from CodeArtifact during the bundling process. How to get CodeArtifact token within the CDK App without using AWS CLI?

`s3_assets.Asset(self, `"bucket-deployment-asset",`
            path=str(pathlib.Path(__file__).parents[1].joinpath("web")), # /asset-input and working directory in the container
            bundling=core.BundlingOptions(
                image=_lambda.Runtime.NODEJS_12_X.bundling_docker_image,
                command=["bash", "-c",
                            "cp -a /asset-input/* /asset-output/",
                            "cd /asset-output/",
                            "npm install --registry=https://xxx.codeartifact.eu-central-1.amazonaws.com/npm/xxx/[email protected]/:_authToken=${CODEARTIFACT_AUTH_TOKEN}"
                        ],
            )    
        )`
@srethira srethira added guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged. labels Aug 24, 2020
@github-actions github-actions bot added the @aws-cdk/pipelines CDK Pipelines library label Aug 24, 2020
@rix0rrr rix0rrr assigned NGL321 and SomayaB and unassigned rix0rrr Aug 25, 2020
@SomayaB SomayaB removed their assignment Sep 4, 2020
@PierreKiwi
Copy link

I have a similar problem but with Python.
I solved the problem but configuring pip first, then mount a volume to share my pip.conf with the building container.

bundling=core.BundlingOptions(
                    image=aws_lambda.Runtime.PYTHON_3_8.bundling_docker_image,
                    command=[
                        "bash",
                        "-c",
                        "pip install -r requirements.txt -t /asset-output && cp -au . /asset-output",
                    ],
                    user="root:root",
                    volumes=[
                        core.DockerVolume(
                            container_path="/root/.config/pip/pip.conf",
                            host_path=f"{Path.home()}/.config/pip/pip.conf",
                        ),
                    ],
                ),

It works but a more elegant approach is probably needed.

@peterwoodworth
Copy link
Contributor

This currently isn't supported - a few feature requests have been opened since this has been opened so I'm going to close this in favor of those: #10298 #10193

@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 guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

6 participants