简体   繁体   中英

How to use AWS CDK CodePipeline without an oauthToken?

I have previously created a CodePipeline for building from a private GitHub Repo as below:

pipeline.addStage({
  stageName: 'Source',
  actions: [
    new GitHubSourceAction({
      actionName: 'Checkout',
      owner: github.ardcOwner, 
      repo: github.raidoSrcRepo,
      branch: "main",
      oauthToken: SecretValue.secretsManager('personal-token' ),
      output: outputSources,
      trigger: GitHubTrigger.NONE,
    }),
  ],
});

The repo in question is now public. Given that no webhook is needed, since the trigger is set to NONE - how do I create new GitHubSourceAction without providing the oauthToken property?

The property is mandatory.
Is there a way to provide a "dummy" value to the GitHubSourceAction for oauthToken such that the account doesn't need to have an unnecessary/unused secret?

I tried to use a dummy value (as opposed to dummy "Secret"):

oauthToken: SecretValue.unsafePlainText("dummy"),

But that failed with "Could not access the GitHub repository".

It was then I remembered that CodePipeline doesn't do a clone, it downloads a zip archive of the HEAD of the repo.

Presumably, CodePipeline needs the secret to download the zip archive from GitHub.

So I don't think CodePipeline can be used with a public GitHub repo without using an OAuth token.

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