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

🌱 cron: pass config as an argument to binaries (4/n) #2279

Merged
merged 11 commits into from
Sep 23, 2022

Conversation

spencerschrock
Copy link
Contributor

What kind of change does this PR introduce?

Part of a series of refactors to generalize the cron infrastructure to enable re-use by the ossf criticality score project

What is the current behavior?

The cron/internal/config/config.yaml file is embedded inside cron binaries, and packaged with the various docker files.
This was not flexible for re-using the cron infrastructure across projects.

What is the new behavior (if this is a feature change)?**

  1. All cron binaries which interact with the config package now support a config flag.
  --config string
        Location of config file (default "/etc/scorecard/config.yaml")
  1. The config file is now volume mounted for k8s cronjobs at /etc/scorecard/config.yaml
  • Tests for the changes have been added (for bug fixes/features)

Which issue(s) this PR fixes

NONE

Special notes for your reviewer

I made a few naming choices, (e.g. storing configs at /etc/scorecard), feel free to nit and I can patch.

Does this PR introduce a user-facing change?

For user-facing changes, please add a concise, human-readable release note to
the release-note

(In particular, describe what changes users might need to make in their
application as a result of this pull request.)

NONE

Signed-off-by: Spencer Schrock <sschrock@google.com>
Signed-off-by: Spencer Schrock <sschrock@google.com>
Signed-off-by: Spencer Schrock <sschrock@google.com>
Signed-off-by: Spencer Schrock <sschrock@google.com>
@codecov
Copy link

codecov bot commented Sep 20, 2022

Codecov Report

Merging #2279 (7be9cff) into main (97df43b) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2279   +/-   ##
=======================================
  Coverage   41.17%   41.17%           
=======================================
  Files         110      110           
  Lines        8774     8774           
=======================================
  Hits         3613     3613           
  Misses       4892     4892           
  Partials      269      269           

@github-actions
Copy link

Integration tests success for
[bc15232]
(https://github.com/ossf/scorecard/actions/runs/3092683082)

cron/internal/bq/main.go Outdated Show resolved Hide resolved
cron/internal/config/config.go Outdated Show resolved Hide resolved
@oliverchang
Copy link
Contributor

@calebbrown FYI

Signed-off-by: Spencer Schrock <sschrock@google.com>
Signed-off-by: Spencer Schrock <sschrock@google.com>
Signed-off-by: Spencer Schrock <sschrock@google.com>
Signed-off-by: Spencer Schrock <sschrock@google.com>
@spencerschrock spencerschrock temporarily deployed to integration-test September 21, 2022 17:36 Inactive
@github-actions
Copy link

Integration tests success for
[6ab5556]
(https://github.com/ossf/scorecard/actions/runs/3099673793)

Signed-off-by: Spencer Schrock <sschrock@google.com>
@spencerschrock spencerschrock temporarily deployed to integration-test September 22, 2022 17:21 Inactive
@github-actions
Copy link

Integration tests success for
[beca636]
(https://github.com/ossf/scorecard/actions/runs/3107432652)

…nded to be temporary to help with GKE rollout.

Signed-off-by: Spencer Schrock <sschrock@google.com>
@spencerschrock spencerschrock requested review from azeemshaikh38 and removed request for olivekl September 22, 2022 18:13
@spencerschrock spencerschrock temporarily deployed to integration-test September 22, 2022 18:13 Inactive
@spencerschrock spencerschrock temporarily deployed to integration-test September 22, 2022 18:16 Inactive
@github-actions
Copy link

Integration tests success for
[c41a577]
(https://github.com/ossf/scorecard/actions/runs/3107749655)

@github-actions
Copy link

Integration tests success for
[c41a577]
(https://github.com/ossf/scorecard/actions/runs/3107749706)

Signed-off-by: Spencer Schrock <sschrock@google.com>
@spencerschrock spencerschrock temporarily deployed to integration-test September 23, 2022 17:35 Inactive
@github-actions
Copy link

Integration tests success for
[7be9cff]
(https://github.com/ossf/scorecard/actions/runs/3114545144)

cron/k8s/controller.yaml Show resolved Hide resolved
@azeemshaikh38 azeemshaikh38 enabled auto-merge (squash) September 23, 2022 20:21
@azeemshaikh38 azeemshaikh38 merged commit a7a503a into ossf:main Sep 23, 2022
@spencerschrock spencerschrock deleted the config-arg branch September 23, 2022 20:43
N8BWert pushed a commit to N8BWert/scorecard that referenced this pull request Nov 28, 2022
* Explicitly read config file instead of embedding it.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Add CLI config arg and ReadConfig() to existing cron binaries.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Volume mount config

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Ignore CLI flag args when reading local filenames in controller.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Hide --config in the config package.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Add config param to k8s files.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Fix test

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Allow fallback to embedded config if no config is passed as arg. Intended to be temporary to help with GKE rollout.

Signed-off-by: Spencer Schrock <sschrock@google.com>

Signed-off-by: Spencer Schrock <sschrock@google.com>
Signed-off-by: nathaniel.wert <nathaniel.wert@kudelskisecurity.com>
N8BWert pushed a commit to N8BWert/scorecard that referenced this pull request Nov 28, 2022
* Explicitly read config file instead of embedding it.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Add CLI config arg and ReadConfig() to existing cron binaries.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Volume mount config

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Ignore CLI flag args when reading local filenames in controller.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Hide --config in the config package.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Add config param to k8s files.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Fix test

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Allow fallback to embedded config if no config is passed as arg. Intended to be temporary to help with GKE rollout.

Signed-off-by: Spencer Schrock <sschrock@google.com>

Signed-off-by: Spencer Schrock <sschrock@google.com>
Signed-off-by: nathaniel.wert <nathaniel.wert@kudelskisecurity.com>
raghavkaul pushed a commit to raghavkaul/scorecard that referenced this pull request Feb 9, 2023
* Explicitly read config file instead of embedding it.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Add CLI config arg and ReadConfig() to existing cron binaries.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Volume mount config

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Ignore CLI flag args when reading local filenames in controller.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Hide --config in the config package.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Add config param to k8s files.

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Fix test

Signed-off-by: Spencer Schrock <sschrock@google.com>

* Allow fallback to embedded config if no config is passed as arg. Intended to be temporary to help with GKE rollout.

Signed-off-by: Spencer Schrock <sschrock@google.com>

Signed-off-by: Spencer Schrock <sschrock@google.com>
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