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

ci(fix): Dependabot のコミットに対する Trivy CI が失敗してしまう問題の修正 #647

Merged
merged 2 commits into from
Dec 24, 2022

Conversation

m1sk9
Copy link
Contributor

@m1sk9 m1sk9 commented Dec 23, 2022

Type of Change:

修正

Cause of the Problem (問題の原因)

@dependabot のコミットは GitHub Actions の仕様上、 読み取り専用として動作するため Code Scanning の結果をアップロードすることができない。

そのため Trivy CI にてスキャンした結果をアップロードできず、CIが落ちてしまっていた。

Dealing with Problems (問題への対処)

上記問題を解決する案として以下のものがあげられたが、今回のエラーが推奨している方法で対処した

  1. Workflowに書き込み権限を与える
  2. @dependabot のブランチに対するプッシュは無視する

Error: Workflows triggered by Dependabot on the "push" event run with read-only access. Uploading Code Scanning results requires write access. To use Code Scanning with Dependabot, please ensure you are using the "pull_request" event for this workflow and avoid triggering on the "push" event for Dependabot branches. See https://docs.github.com/en/code-security/secure-coding/configuring-code-scanning#scanning-on-push for more information on how to configure these events.

Details of implementation (実施内容)

@dependabot は依存関係アップデートの際 dependabot/<ecosystem>/<branch>/<dependency> をブランチとして作業する ( 参考: #646 ) ので、on.push.branches にて ! を付けて無視するブランチとして定義した。

プルリクエストに対するトリガーには権限が与えられるため、スキャンは実行される。

### Additional Information (追加情報)

@m1sk9 m1sk9 added bug labels Dec 23, 2022
@m1sk9 m1sk9 self-assigned this Dec 23, 2022
@m1sk9 m1sk9 changed the title ci(fix): @dependabot のコミットに対する Trivy CI が失敗してしまう問題の修正 ci(fix): Dependabot のコミットに対する Trivy CI が失敗してしまう問題の修正 Dec 23, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #647 (0855ad3) into main (f3f09c4) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #647   +/-   ##
=======================================
  Coverage   73.25%   73.25%           
=======================================
  Files          64       64           
  Lines        4551     4551           
  Branches      418      418           
=======================================
  Hits         3334     3334           
  Misses        802      802           
  Partials      415      415           
Flag Coverage Δ
unittests 73.25% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@m1sk9 m1sk9 merged commit 2653b0a into main Dec 24, 2022
@m1sk9 m1sk9 deleted the fix/dependabot-trivy-error branch December 24, 2022 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants