From 6a21afb4105d4f140a40231505ce58e720dee8b4 Mon Sep 17 00:00:00 2001 From: Azeem Shaikh Date: Wed, 25 May 2022 13:46:50 -0700 Subject: [PATCH 1/2] Fix bug in cron setup (#1959) Co-authored-by: Azeem Shaikh --- cron/k8s/controller.release.yaml | 3 --- cron/k8s/{transfer.release-v2.yaml => transfer.release.yaml} | 0 cron/k8s/{transfer-v2.yaml => transfer.yaml} | 0 3 files changed, 3 deletions(-) rename cron/k8s/{transfer.release-v2.yaml => transfer.release.yaml} (100%) rename cron/k8s/{transfer-v2.yaml => transfer.yaml} (100%) diff --git a/cron/k8s/controller.release.yaml b/cron/k8s/controller.release.yaml index 7aeb1135e98..ae0b0e61e73 100644 --- a/cron/k8s/controller.release.yaml +++ b/cron/k8s/controller.release.yaml @@ -58,9 +58,6 @@ spec: - name: SCORECARD_REQUEST_TOPIC_URL value: "gcppubsub://projects/openssf/topics/scorecard-batch-requests-releasetest" - name: SCORECARD_DATA_BUCKET_URL - value: "gs://ossf-scorecard-data-releasetest" - # UPGRADEv2: to remove. - - name: SCORECARD_DATA_BUCKET_URLV2 value: "gs://ossf-scorecard-data-releasetest2" # Raw results. - name: RAW_SCORECARD_DATA_BUCKET_URL diff --git a/cron/k8s/transfer.release-v2.yaml b/cron/k8s/transfer.release.yaml similarity index 100% rename from cron/k8s/transfer.release-v2.yaml rename to cron/k8s/transfer.release.yaml diff --git a/cron/k8s/transfer-v2.yaml b/cron/k8s/transfer.yaml similarity index 100% rename from cron/k8s/transfer-v2.yaml rename to cron/k8s/transfer.yaml From d1714a289acfb34d59000e3c3b7a34b599b23348 Mon Sep 17 00:00:00 2001 From: Azeem Shaikh Date: Wed, 25 May 2022 15:37:22 -0700 Subject: [PATCH 2/2] Move the cron job to `internal` package (#1960) Co-authored-by: Azeem Shaikh --- .gitignore | 18 ++--- Makefile | 80 +++++++++---------- cron/cloudbuild/cii.yaml | 2 +- cron/cloudbuild/controller.yaml | 2 +- cron/cloudbuild/transfer.yaml | 2 +- cron/cloudbuild/webhook.release.yaml | 2 +- cron/cloudbuild/worker.yaml | 2 +- cron/{ => internal}/bq/Dockerfile | 4 +- cron/{ => internal}/bq/main.go | 4 +- cron/{ => internal}/bq/transfer.go | 0 cron/{ => internal}/cii/Dockerfile | 4 +- cron/{ => internal}/cii/main.go | 4 +- cron/{ => internal}/config/config.go | 0 cron/{ => internal}/config/config.yaml | 0 cron/{ => internal}/config/config_test.go | 0 .../{ => internal}/config/testdata/basic.yaml | 0 .../config/testdata/missing_field.yaml | 0 cron/{ => internal}/controller/Dockerfile | 10 +-- cron/{ => internal}/controller/main.go | 6 +- cron/{ => internal}/data/README.md | 0 cron/{ => internal}/data/add/main.go | 2 +- cron/{ => internal}/data/add/main_test.go | 2 +- .../data/add/testdata/add_metadata.csv | 0 .../data/add/testdata/no_change.csv | 0 .../data/add/testdata/skip_empty.csv | 0 .../data/add/testdata/skip_empty_2.csv | 0 .../data/add/testdata/skip_latest.csv | 0 cron/{ => internal}/data/blob.go | 2 +- cron/{ => internal}/data/blob_test.go | 0 cron/{ => internal}/data/format.go | 0 cron/{ => internal}/data/format_test.go | 0 cron/{ => internal}/data/iterator.go | 0 cron/{ => internal}/data/iterator_test.go | 0 cron/{ => internal}/data/metadata.pb.go | 0 cron/{ => internal}/data/metadata.proto | 0 cron/{ => internal}/data/projects.csv | 0 cron/{ => internal}/data/request.pb.go | 0 cron/{ => internal}/data/request.proto | 0 cron/{ => internal}/data/testdata/basic.csv | 0 cron/{ => internal}/data/testdata/comment.csv | 0 .../data/testdata/empty_row.csv | 0 .../data/testdata/extra_column.csv | 0 .../data/testdata/failing_urls.csv | 0 cron/{ => internal}/data/update/dependency.go | 2 +- cron/{ => internal}/data/update/main.go | 2 +- cron/{ => internal}/data/validate/main.go | 2 +- cron/{ => internal}/data/writer.go | 0 cron/{ => internal}/data/writer_test.go | 0 cron/{ => internal}/format/bq.raw.schema | 0 cron/{ => internal}/format/json.go | 0 cron/{ => internal}/format/json.raw.schema | 0 cron/{ => internal}/format/json.v2.schema | 0 .../{ => internal}/format/json_raw_results.go | 0 cron/{ => internal}/format/json_test.go | 0 cron/{ => internal}/format/mock_doc.go | 0 cron/{ => internal}/format/schema_gen.go | 0 cron/{ => internal}/format/schema_gen_test.go | 0 .../format/testdata/bq-valid.schema | 0 .../format/testdata/check1.json | 0 .../format/testdata/check2.json | 0 .../format/testdata/check3.json | 0 .../format/testdata/check4.json | 0 .../format/testdata/check5.json | 0 .../format/testdata/check6.json | 0 .../format/testdata/valid.schema | 0 cron/{ => internal}/monitoring/exporter.go | 2 +- cron/{ => internal}/monitoring/printer.go | 0 cron/{ => internal}/pubsub/publisher.go | 2 +- cron/{ => internal}/pubsub/publisher_test.go | 2 +- cron/{ => internal}/pubsub/subscriber.go | 2 +- cron/{ => internal}/pubsub/subscriber_gcs.go | 2 +- .../pubsub/subscriber_gocloud.go | 2 +- .../pubsub/subscriber_gocloud_test.go | 2 +- cron/{ => internal}/shuffle/main.go | 2 +- cron/{ => internal}/webhook/Dockerfile | 4 +- cron/{ => internal}/webhook/main.go | 2 +- cron/{ => internal}/worker/Dockerfile | 4 +- cron/{ => internal}/worker/main.go | 10 +-- 78 files changed, 94 insertions(+), 94 deletions(-) rename cron/{ => internal}/bq/Dockerfile (87%) rename cron/{ => internal}/bq/main.go (98%) rename cron/{ => internal}/bq/transfer.go (100%) rename cron/{ => internal}/cii/Dockerfile (88%) rename cron/{ => internal}/cii/main.go (96%) rename cron/{ => internal}/config/config.go (100%) rename cron/{ => internal}/config/config.yaml (100%) rename cron/{ => internal}/config/config_test.go (100%) rename cron/{ => internal}/config/testdata/basic.yaml (100%) rename cron/{ => internal}/config/testdata/missing_field.yaml (100%) rename cron/{ => internal}/controller/Dockerfile (71%) rename cron/{ => internal}/controller/main.go (96%) rename cron/{ => internal}/data/README.md (100%) rename cron/{ => internal}/data/add/main.go (98%) rename cron/{ => internal}/data/add/main_test.go (98%) rename cron/{ => internal}/data/add/testdata/add_metadata.csv (100%) rename cron/{ => internal}/data/add/testdata/no_change.csv (100%) rename cron/{ => internal}/data/add/testdata/skip_empty.csv (100%) rename cron/{ => internal}/data/add/testdata/skip_empty_2.csv (100%) rename cron/{ => internal}/data/add/testdata/skip_latest.csv (100%) rename cron/{ => internal}/data/blob.go (98%) rename cron/{ => internal}/data/blob_test.go (100%) rename cron/{ => internal}/data/format.go (100%) rename cron/{ => internal}/data/format_test.go (100%) rename cron/{ => internal}/data/iterator.go (100%) rename cron/{ => internal}/data/iterator_test.go (100%) rename cron/{ => internal}/data/metadata.pb.go (100%) rename cron/{ => internal}/data/metadata.proto (100%) rename cron/{ => internal}/data/projects.csv (100%) rename cron/{ => internal}/data/request.pb.go (100%) rename cron/{ => internal}/data/request.proto (100%) rename cron/{ => internal}/data/testdata/basic.csv (100%) rename cron/{ => internal}/data/testdata/comment.csv (100%) rename cron/{ => internal}/data/testdata/empty_row.csv (100%) rename cron/{ => internal}/data/testdata/extra_column.csv (100%) rename cron/{ => internal}/data/testdata/failing_urls.csv (100%) rename cron/{ => internal}/data/update/dependency.go (99%) rename cron/{ => internal}/data/update/main.go (96%) rename cron/{ => internal}/data/validate/main.go (96%) rename cron/{ => internal}/data/writer.go (100%) rename cron/{ => internal}/data/writer_test.go (100%) rename cron/{ => internal}/format/bq.raw.schema (100%) rename cron/{ => internal}/format/json.go (100%) rename cron/{ => internal}/format/json.raw.schema (100%) rename cron/{ => internal}/format/json.v2.schema (100%) rename cron/{ => internal}/format/json_raw_results.go (100%) rename cron/{ => internal}/format/json_test.go (100%) rename cron/{ => internal}/format/mock_doc.go (100%) rename cron/{ => internal}/format/schema_gen.go (100%) rename cron/{ => internal}/format/schema_gen_test.go (100%) rename cron/{ => internal}/format/testdata/bq-valid.schema (100%) rename cron/{ => internal}/format/testdata/check1.json (100%) rename cron/{ => internal}/format/testdata/check2.json (100%) rename cron/{ => internal}/format/testdata/check3.json (100%) rename cron/{ => internal}/format/testdata/check4.json (100%) rename cron/{ => internal}/format/testdata/check5.json (100%) rename cron/{ => internal}/format/testdata/check6.json (100%) rename cron/{ => internal}/format/testdata/valid.schema (100%) rename cron/{ => internal}/monitoring/exporter.go (98%) rename cron/{ => internal}/monitoring/printer.go (100%) rename cron/{ => internal}/pubsub/publisher.go (97%) rename cron/{ => internal}/pubsub/publisher_test.go (97%) rename cron/{ => internal}/pubsub/subscriber.go (96%) rename cron/{ => internal}/pubsub/subscriber_gcs.go (98%) rename cron/{ => internal}/pubsub/subscriber_gocloud.go (97%) rename cron/{ => internal}/pubsub/subscriber_gocloud_test.go (98%) rename cron/{ => internal}/shuffle/main.go (96%) rename cron/{ => internal}/webhook/Dockerfile (88%) rename cron/{ => internal}/webhook/main.go (98%) rename cron/{ => internal}/worker/Dockerfile (88%) rename cron/{ => internal}/worker/main.go (96%) diff --git a/.gitignore b/.gitignore index 384d0cfac79..eda72798274 100644 --- a/.gitignore +++ b/.gitignore @@ -2,15 +2,15 @@ scorecard gitblobcache clients/githubrepo/roundtripper/tokens/server/github-auth-server -cron/data/add/add -cron/data/validate/validate -cron/data/update/projects-update -cron/controller/controller -cron/worker/worker -cron/cii/cii-worker -cron/shuffle/shuffle -cron/webhook/webhook -cron/bq/data-transfer +cron/internal/data/add/add +cron/internal/data/validate/validate +cron/internal/data/update/projects-update +cron/internal/controller/controller +cron/internal/worker/worker +cron/internal/cii/cii-worker +cron/internal/shuffle/shuffle +cron/internal/webhook/webhook +cron/internal/bq/data-transfer # Binaries for programs and plugins. *.exe diff --git a/Makefile b/Makefile index 230cd723804..b5270ec8f8a 100644 --- a/Makefile +++ b/Makefile @@ -74,16 +74,16 @@ check-osv: $(install) go list -m -f '{{if not (or .Main)}}{{.Path}}@{{.Version}}_{{.Replace}}{{end}}' all \ | stunning-tribble -add-projects: ## Adds new projects to ./cron/data/projects.csv -add-projects: ./cron/data/projects.csv | build-add-script - # Add new projects to ./cron/data/projects.csv - ./cron/data/add/add ./cron/data/projects.csv ./cron/data/projects.new.csv - mv ./cron/data/projects.new.csv ./cron/data/projects.csv +add-projects: ## Adds new projects to ./cron/internal/data/projects.csv +add-projects: ./cron/internal/data/projects.csv | build-add-script + # Add new projects to ./cron/internal/data/projects.csv + ./cron/internal/data/add/add ./cron/internal/data/projects.csv ./cron/internal/data/projects.new.csv + mv ./cron/internal/data/projects.new.csv ./cron/internal/data/projects.csv -validate-projects: ## Validates ./cron/data/projects.csv -validate-projects: ./cron/data/projects.csv | build-validate-script - # Validate ./cron/data/projects.csv - ./cron/data/validate/validate ./cron/data/projects.csv +validate-projects: ## Validates ./cron/internal/data/projects.csv +validate-projects: ./cron/internal/data/projects.csv | build-validate-script + # Validate ./cron/internal/data/projects.csv + ./cron/internal/data/validate/validate ./cron/internal/data/projects.csv tree-status: | all-targets-update-dependencies ## Verify tree is clean and all changes are committed # Verify the tree is clean and all changes are commited @@ -103,11 +103,11 @@ build: ## Build all binaries and images in the repo. build: $(build-targets) build-proto: ## Compiles and generates all required protobufs -build-proto: cron/data/request.pb.go cron/data/metadata.pb.go -cron/data/request.pb.go: cron/data/request.proto | $(PROTOC) - protoc --go_out=../../../ cron/data/request.proto -cron/data/metadata.pb.go: cron/data/metadata.proto | $(PROTOC) - protoc --go_out=../../../ cron/data/metadata.proto +build-proto: cron/internal/data/request.pb.go cron/internal/data/metadata.pb.go +cron/internal/data/request.pb.go: cron/internal/data/request.proto | $(PROTOC) + protoc --go_out=../../../ cron/internal/data/request.proto +cron/internal/data/metadata.pb.go: cron/internal/data/metadata.proto | $(PROTOC) + protoc --go_out=../../../ cron/internal/data/metadata.proto generate-mocks: ## Compiles and generates all mocks using mockgen. generate-mocks: clients/mockclients/repo_client.go clients/mockclients/repo.go clients/mockclients/cii_client.go checks/mockclients/vulnerabilities.go cmd/packagemanager_mockclient.go @@ -147,24 +147,24 @@ build-releaser: ## Runs goreleaser on the repo build-controller: ## Runs go build on the cron PubSub controller # Run go build on the cron PubSub controller - cd cron/controller && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o controller + cd cron/internal/controller && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o controller build-worker: ## Runs go build on the cron PubSub worker # Run go build on the cron PubSub worker - cd cron/worker && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o worker + cd cron/internal/worker && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o worker build-cii-worker: ## Runs go build on the CII worker # Run go build on the CII worker - cd cron/cii && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o cii-worker + cd cron/internal/cii && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o cii-worker build-shuffler: ## Runs go build on the cron shuffle script # Run go build on the cron shuffle script - cd cron/shuffle && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o shuffle + cd cron/internal/shuffle && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o shuffle build-bq-transfer: ## Runs go build on the BQ transfer cron job -build-bq-transfer: ./cron/bq/*.go +build-bq-transfer: ./cron/internal/bq/*.go # Run go build on the Copier cron job - cd cron/bq && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o data-transfer + cd cron/internal/bq && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o data-transfer build-github-server: ## Runs go build on the GitHub auth server build-github-server: ./clients/githubrepo/roundtripper/tokens/* @@ -174,25 +174,25 @@ build-github-server: ./clients/githubrepo/roundtripper/tokens/* build-webhook: ## Runs go build on the cron webhook # Run go build on the cron webhook - cd cron/webhook && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o webhook + cd cron/internal/webhook && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o webhook build-add-script: ## Runs go build on the add script -build-add-script: cron/data/add/add -cron/data/add/add: cron/data/add/*.go cron/data/*.go cron/data/projects.csv +build-add-script: cron/internal/data/add/add +cron/internal/data/add/add: cron/internal/data/add/*.go cron/internal/data/*.go cron/internal/data/projects.csv # Run go build on the add script - cd cron/data/add && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o add + cd cron/internal/data/add && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o add build-validate-script: ## Runs go build on the validate script -build-validate-script: cron/data/validate/validate -cron/data/validate/validate: cron/data/validate/*.go cron/data/*.go cron/data/projects.csv +build-validate-script: cron/internal/data/validate/validate +cron/internal/data/validate/validate: cron/internal/data/validate/*.go cron/internal/data/*.go cron/internal/data/projects.csv # Run go build on the validate script - cd cron/data/validate && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o validate + cd cron/internal/data/validate && CGO_ENABLED=0 go build -trimpath -a -ldflags '$(LDFLAGS)' -o validate build-update-script: ## Runs go build on the update script -build-update-script: cron/data/update/projects-update -cron/data/update/projects-update: cron/data/update/*.go cron/data/*.go +build-update-script: cron/internal/data/update/projects-update +cron/internal/data/update/projects-update: cron/internal/data/update/*.go cron/internal/data/*.go # Run go build on the update script - cd cron/data/update && CGO_ENABLED=0 go build -trimpath -a -tags netgo -ldflags '$(LDFLAGS)' -o projects-update + cd cron/internal/data/update && CGO_ENABLED=0 go build -trimpath -a -tags netgo -ldflags '$(LDFLAGS)' -o projects-update ko-targets = scorecard-ko cron-controller-ko cron-worker-ko cron-cii-worker-ko cron-bq-transfer-ko cron-webhook-ko cron-github-server-ko .PHONY: ko-build-everything $(ko-targets) @@ -212,7 +212,7 @@ cron-controller-ko: --push=false \ --sbom=none \ --platform=$(PLATFORM)\ - --tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4/cron/controller + --tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4/cron/internal/controller cron-worker-ko: $(call_create_kocache_path) KO_DATA_DATE_EPOCH=$(SOURCE_DATE_EPOCH) KO_DOCKER_REPO=${KO_PREFIX}/$(IMAGE_NAME)-batch-worker LDFLAGS="$(LDFLAGS)" \ @@ -220,7 +220,7 @@ cron-worker-ko: --push=false \ --sbom=none \ --platform=$(PLATFORM)\ - --tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4/cron/worker + --tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4/cron/internal/worker cron-cii-worker-ko: $(call_create_kocache_path) KO_DATA_DATE_EPOCH=$(SOURCE_DATE_EPOCH) KO_DOCKER_REPO=${KO_PREFIX}/$(IMAGE_NAME)-cii-worker LDFLAGS="$(LDFLAGS)" \ @@ -228,7 +228,7 @@ cron-cii-worker-ko: --push=false \ --sbom=none \ --platform=$(PLATFORM)\ - --tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4/cron/cii + --tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4/cron/internal/cii cron-bq-transfer-ko: $(call_create_kocache_path) KO_DATA_DATE_EPOCH=$(SOURCE_DATE_EPOCH) KO_DOCKER_REPO=${KO_PREFIX}/$(IMAGE_NAME)-bq-transfer LDFLAGS="$(LDFLAGS)" \ @@ -236,7 +236,7 @@ cron-bq-transfer-ko: --push=false \ --sbom=none \ --platform=$(PLATFORM)\ - --tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4/cron/bq + --tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4/cron/internal/bq cron-webhook-ko: $(call_create_kocache_path) KO_DATA_DATE_EPOCH=$(SOURCE_DATE_EPOCH) KO_DOCKER_REPO=${KO_PREFIX}/$(IMAGE_NAME)-cron-webhook LDFLAGS="$(LDFLAGS)" \ @@ -244,7 +244,7 @@ cron-webhook-ko: --push=false \ --sbom=none \ --platform=$(PLATFORM)\ - --tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4/cron/webhook + --tags latest,$(GIT_VERSION),$(GIT_HASH) github.com/ossf/scorecard/v4/cron/internal/webhook cron-github-server-ko: $(call_create_kocache_path) KO_DATA_DATE_EPOCH=$(SOURCE_DATE_EPOCH) KO_DOCKER_REPO=${KO_PREFIX}/$(IMAGE_NAME)-github-server LDFLAGS="$(LDFLAGS)" \ @@ -261,15 +261,15 @@ dockerbuild: $(docker-targets) scorecard-docker: DOCKER_BUILDKIT=1 docker build . --file Dockerfile --tag $(IMAGE_NAME) cron-controller-docker: - DOCKER_BUILDKIT=1 docker build . --file cron/controller/Dockerfile --tag $(IMAGE_NAME)-batch-controller + DOCKER_BUILDKIT=1 docker build . --file cron/internal/controller/Dockerfile --tag $(IMAGE_NAME)-batch-controller cron-worker-docker: - DOCKER_BUILDKIT=1 docker build . --file cron/worker/Dockerfile --tag $(IMAGE_NAME)-batch-worker + DOCKER_BUILDKIT=1 docker build . --file cron/internal/worker/Dockerfile --tag $(IMAGE_NAME)-batch-worker cron-cii-worker-docker: - DOCKER_BUILDKIT=1 docker build . --file cron/cii/Dockerfile --tag $(IMAGE_NAME)-cii-worker + DOCKER_BUILDKIT=1 docker build . --file cron/internal/cii/Dockerfile --tag $(IMAGE_NAME)-cii-worker cron-bq-transfer-docker: - DOCKER_BUILDKIT=1 docker build . --file cron/bq/Dockerfile --tag $(IMAGE_NAME)-bq-transfer + DOCKER_BUILDKIT=1 docker build . --file cron/internal/bq/Dockerfile --tag $(IMAGE_NAME)-bq-transfer cron-webhook-docker: - DOCKER_BUILDKIT=1 docker build . --file cron/webhook/Dockerfile --tag ${IMAGE_NAME}-webhook + DOCKER_BUILDKIT=1 docker build . --file cron/internal/webhook/Dockerfile --tag ${IMAGE_NAME}-webhook cron-github-server-docker: DOCKER_BUILDKIT=1 docker build . --file clients/githubrepo/roundtripper/tokens/server/Dockerfile --tag ${IMAGE_NAME}-github-server ############################################################################### diff --git a/cron/cloudbuild/cii.yaml b/cron/cloudbuild/cii.yaml index 33b4431f97e..c3c2856f572 100644 --- a/cron/cloudbuild/cii.yaml +++ b/cron/cloudbuild/cii.yaml @@ -18,5 +18,5 @@ steps: '--build-arg', 'COMMIT_SHA=$COMMIT_SHA', '-t', 'gcr.io/openssf/scorecard-cii-worker:$COMMIT_SHA', '-t', 'gcr.io/openssf/scorecard-cii-worker:latest', - '-f', 'cron/cii/Dockerfile'] + '-f', 'cron/internal/cii/Dockerfile'] images: ['gcr.io/openssf/scorecard-cii-worker'] diff --git a/cron/cloudbuild/controller.yaml b/cron/cloudbuild/controller.yaml index 23d6f137577..a7db912eafc 100644 --- a/cron/cloudbuild/controller.yaml +++ b/cron/cloudbuild/controller.yaml @@ -18,5 +18,5 @@ steps: '--build-arg', 'COMMIT_SHA=$COMMIT_SHA', '-t', 'gcr.io/openssf/scorecard-batch-controller:$COMMIT_SHA', '-t', 'gcr.io/openssf/scorecard-batch-controller:latest', - '-f', 'cron/controller/Dockerfile'] + '-f', 'cron/internal/controller/Dockerfile'] images: ['gcr.io/openssf/scorecard-batch-controller'] diff --git a/cron/cloudbuild/transfer.yaml b/cron/cloudbuild/transfer.yaml index e5a1042a6db..e370777ef3e 100644 --- a/cron/cloudbuild/transfer.yaml +++ b/cron/cloudbuild/transfer.yaml @@ -17,5 +17,5 @@ steps: args: ['build', '.', '-t', 'gcr.io/openssf/scorecard-bq-transfer:$COMMIT_SHA', '-t', 'gcr.io/openssf/scorecard-bq-transfer:latest', - '-f', 'cron/bq/Dockerfile'] + '-f', 'cron/internal/bq/Dockerfile'] images: ['gcr.io/openssf/scorecard-bq-transfer'] diff --git a/cron/cloudbuild/webhook.release.yaml b/cron/cloudbuild/webhook.release.yaml index d160baa7935..4d44834831b 100644 --- a/cron/cloudbuild/webhook.release.yaml +++ b/cron/cloudbuild/webhook.release.yaml @@ -17,5 +17,5 @@ steps: args: ['build', '.', '-t', 'gcr.io/openssf/scorecard-webhook-releasetest:$COMMIT_SHA', '-t', 'gcr.io/openssf/scorecard-webhook-releasetest:latest', - '-f', 'cron/webhook/Dockerfile'] + '-f', 'cron/internal/webhook/Dockerfile'] images: ['gcr.io/openssf/scorecard-webhook-releasetest'] diff --git a/cron/cloudbuild/worker.yaml b/cron/cloudbuild/worker.yaml index 41749248534..e1663203a48 100644 --- a/cron/cloudbuild/worker.yaml +++ b/cron/cloudbuild/worker.yaml @@ -20,5 +20,5 @@ steps: args: ['build', '.', '-t', 'gcr.io/openssf/scorecard-batch-worker:$COMMIT_SHA', '-t', 'gcr.io/openssf/scorecard-batch-worker:latest', - '-f', 'cron/worker/Dockerfile'] + '-f', 'cron/internal/worker/Dockerfile'] images: ['gcr.io/openssf/scorecard-batch-worker'] diff --git a/cron/bq/Dockerfile b/cron/internal/bq/Dockerfile similarity index 87% rename from cron/bq/Dockerfile rename to cron/internal/bq/Dockerfile index 6dc2983e0a1..1aff4da7ba6 100644 --- a/cron/bq/Dockerfile +++ b/cron/internal/bq/Dockerfile @@ -25,5 +25,5 @@ ARG TARGETARCH RUN CGO_ENABLED=0 make build-bq-transfer FROM gcr.io/distroless/base:nonroot@sha256:19d927c16ddb5415d5f6f529dbbeb13c460b84b304b97af886998d3fcf18ac81 -COPY --from=transfer /src/cron/bq/data-transfer cron/bq/data-transfer -ENTRYPOINT ["cron/bq/data-transfer"] +COPY --from=transfer /src/cron/internal/bq/data-transfer cron/internal/bq/data-transfer +ENTRYPOINT ["cron/internal/bq/data-transfer"] diff --git a/cron/bq/main.go b/cron/internal/bq/main.go similarity index 98% rename from cron/bq/main.go rename to cron/internal/bq/main.go index 5882643e05c..ef89ae930c5 100644 --- a/cron/bq/main.go +++ b/cron/internal/bq/main.go @@ -27,8 +27,8 @@ import ( "google.golang.org/protobuf/encoding/protojson" - "github.com/ossf/scorecard/v4/cron/config" - "github.com/ossf/scorecard/v4/cron/data" + "github.com/ossf/scorecard/v4/cron/internal/config" + "github.com/ossf/scorecard/v4/cron/internal/data" ) type shardSummary struct { diff --git a/cron/bq/transfer.go b/cron/internal/bq/transfer.go similarity index 100% rename from cron/bq/transfer.go rename to cron/internal/bq/transfer.go diff --git a/cron/cii/Dockerfile b/cron/internal/cii/Dockerfile similarity index 88% rename from cron/cii/Dockerfile rename to cron/internal/cii/Dockerfile index 6f6ffef10cf..d244b8f721c 100644 --- a/cron/cii/Dockerfile +++ b/cron/internal/cii/Dockerfile @@ -25,5 +25,5 @@ ARG TARGETARCH RUN CGO_ENABLED=0 make build-cii-worker FROM gcr.io/distroless/base:nonroot@sha256:46d4514c17aca7a68559ee03975983339fc548e6d1014e2d7633f9123f2d3c59 -COPY --from=cii /src/cron/cii/cii-worker cron/cii/cii-worker -ENTRYPOINT ["cron/cii/cii-worker"] +COPY --from=cii /src/cron/internal/cii/cii-worker cron/internal/cii/cii-worker +ENTRYPOINT ["cron/internal/cii/cii-worker"] diff --git a/cron/cii/main.go b/cron/internal/cii/main.go similarity index 96% rename from cron/cii/main.go rename to cron/internal/cii/main.go index b936263fcf2..e3836497d31 100644 --- a/cron/cii/main.go +++ b/cron/internal/cii/main.go @@ -24,8 +24,8 @@ import ( "strings" "github.com/ossf/scorecard/v4/clients" - "github.com/ossf/scorecard/v4/cron/config" - "github.com/ossf/scorecard/v4/cron/data" + "github.com/ossf/scorecard/v4/cron/internal/config" + "github.com/ossf/scorecard/v4/cron/internal/data" ) const ciiBaseURL = "https://bestpractices.coreinfrastructure.org/projects.json" diff --git a/cron/config/config.go b/cron/internal/config/config.go similarity index 100% rename from cron/config/config.go rename to cron/internal/config/config.go diff --git a/cron/config/config.yaml b/cron/internal/config/config.yaml similarity index 100% rename from cron/config/config.yaml rename to cron/internal/config/config.yaml diff --git a/cron/config/config_test.go b/cron/internal/config/config_test.go similarity index 100% rename from cron/config/config_test.go rename to cron/internal/config/config_test.go diff --git a/cron/config/testdata/basic.yaml b/cron/internal/config/testdata/basic.yaml similarity index 100% rename from cron/config/testdata/basic.yaml rename to cron/internal/config/testdata/basic.yaml diff --git a/cron/config/testdata/missing_field.yaml b/cron/internal/config/testdata/missing_field.yaml similarity index 100% rename from cron/config/testdata/missing_field.yaml rename to cron/internal/config/testdata/missing_field.yaml diff --git a/cron/controller/Dockerfile b/cron/internal/controller/Dockerfile similarity index 71% rename from cron/controller/Dockerfile rename to cron/internal/controller/Dockerfile index e775d29533a..046e4903ec3 100644 --- a/cron/controller/Dockerfile +++ b/cron/internal/controller/Dockerfile @@ -23,7 +23,7 @@ FROM base AS shuffle ARG TARGETOS ARG TARGETARCH RUN CGO_ENABLED=0 make build-shuffler -RUN ./cron/shuffle/shuffle 2500 cron/data/projects.csv cron/data/projects.release.csv +RUN ./cron/internal/shuffle/shuffle 2500 cron/internal/data/projects.csv cron/internal/data/projects.release.csv FROM base AS controller ARG TARGETOS @@ -31,7 +31,7 @@ ARG TARGETARCH RUN CGO_ENABLED=0 make build-controller FROM gcr.io/distroless/base:nonroot@sha256:d65ac1a65a4d82a48ebd0a22aea2acdd95d7abeeda245dfee932ec0018c781f4 -COPY ./cron/data/projects*csv cron/data/ -COPY --from=shuffle /src/cron/data/projects.release.csv cron/data/projects.release.csv -COPY --from=controller /src/cron/controller/controller cron/controller/controller -ENTRYPOINT ["cron/controller/controller"] +COPY ./cron/internal/data/projects*csv cron/data/ +COPY --from=shuffle /src/cron/internal/data/projects.release.csv cron/internal/data/projects.release.csv +COPY --from=controller /src/cron/internal/controller/controller cron/internal/controller/controller +ENTRYPOINT ["cron/internal/controller/controller"] diff --git a/cron/controller/main.go b/cron/internal/controller/main.go similarity index 96% rename from cron/controller/main.go rename to cron/internal/controller/main.go index 6fa1ccbf323..7b5ff9d3d83 100644 --- a/cron/controller/main.go +++ b/cron/internal/controller/main.go @@ -26,9 +26,9 @@ import ( "sigs.k8s.io/release-utils/version" "github.com/ossf/scorecard/v4/clients" - "github.com/ossf/scorecard/v4/cron/config" - "github.com/ossf/scorecard/v4/cron/data" - "github.com/ossf/scorecard/v4/cron/pubsub" + "github.com/ossf/scorecard/v4/cron/internal/config" + "github.com/ossf/scorecard/v4/cron/internal/data" + "github.com/ossf/scorecard/v4/cron/internal/pubsub" ) var headSHA = clients.HeadSHA diff --git a/cron/data/README.md b/cron/internal/data/README.md similarity index 100% rename from cron/data/README.md rename to cron/internal/data/README.md diff --git a/cron/data/add/main.go b/cron/internal/data/add/main.go similarity index 98% rename from cron/data/add/main.go rename to cron/internal/data/add/main.go index d7da4eb4969..a452aaababf 100644 --- a/cron/data/add/main.go +++ b/cron/internal/data/add/main.go @@ -20,7 +20,7 @@ import ( "fmt" "os" - "github.com/ossf/scorecard/v4/cron/data" + "github.com/ossf/scorecard/v4/cron/internal/data" ) // Script to add new project repositories to the projects.csv file: diff --git a/cron/data/add/main_test.go b/cron/internal/data/add/main_test.go similarity index 98% rename from cron/data/add/main_test.go rename to cron/internal/data/add/main_test.go index 2ee0401dedb..3a7ea8acf6f 100644 --- a/cron/data/add/main_test.go +++ b/cron/internal/data/add/main_test.go @@ -22,7 +22,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/ossf/scorecard/v4/cron/data" + "github.com/ossf/scorecard/v4/cron/internal/data" ) func lessThanURI(x, y data.RepoFormat) bool { diff --git a/cron/data/add/testdata/add_metadata.csv b/cron/internal/data/add/testdata/add_metadata.csv similarity index 100% rename from cron/data/add/testdata/add_metadata.csv rename to cron/internal/data/add/testdata/add_metadata.csv diff --git a/cron/data/add/testdata/no_change.csv b/cron/internal/data/add/testdata/no_change.csv similarity index 100% rename from cron/data/add/testdata/no_change.csv rename to cron/internal/data/add/testdata/no_change.csv diff --git a/cron/data/add/testdata/skip_empty.csv b/cron/internal/data/add/testdata/skip_empty.csv similarity index 100% rename from cron/data/add/testdata/skip_empty.csv rename to cron/internal/data/add/testdata/skip_empty.csv diff --git a/cron/data/add/testdata/skip_empty_2.csv b/cron/internal/data/add/testdata/skip_empty_2.csv similarity index 100% rename from cron/data/add/testdata/skip_empty_2.csv rename to cron/internal/data/add/testdata/skip_empty_2.csv diff --git a/cron/data/add/testdata/skip_latest.csv b/cron/internal/data/add/testdata/skip_latest.csv similarity index 100% rename from cron/data/add/testdata/skip_latest.csv rename to cron/internal/data/add/testdata/skip_latest.csv diff --git a/cron/data/blob.go b/cron/internal/data/blob.go similarity index 98% rename from cron/data/blob.go rename to cron/internal/data/blob.go index 183bc5f8a64..fb43eb826ab 100644 --- a/cron/data/blob.go +++ b/cron/internal/data/blob.go @@ -26,7 +26,7 @@ import ( // Needed to link in GCP drivers. _ "gocloud.dev/blob/gcsblob" - "github.com/ossf/scorecard/v4/cron/config" + "github.com/ossf/scorecard/v4/cron/internal/config" ) const ( diff --git a/cron/data/blob_test.go b/cron/internal/data/blob_test.go similarity index 100% rename from cron/data/blob_test.go rename to cron/internal/data/blob_test.go diff --git a/cron/data/format.go b/cron/internal/data/format.go similarity index 100% rename from cron/data/format.go rename to cron/internal/data/format.go diff --git a/cron/data/format_test.go b/cron/internal/data/format_test.go similarity index 100% rename from cron/data/format_test.go rename to cron/internal/data/format_test.go diff --git a/cron/data/iterator.go b/cron/internal/data/iterator.go similarity index 100% rename from cron/data/iterator.go rename to cron/internal/data/iterator.go diff --git a/cron/data/iterator_test.go b/cron/internal/data/iterator_test.go similarity index 100% rename from cron/data/iterator_test.go rename to cron/internal/data/iterator_test.go diff --git a/cron/data/metadata.pb.go b/cron/internal/data/metadata.pb.go similarity index 100% rename from cron/data/metadata.pb.go rename to cron/internal/data/metadata.pb.go diff --git a/cron/data/metadata.proto b/cron/internal/data/metadata.proto similarity index 100% rename from cron/data/metadata.proto rename to cron/internal/data/metadata.proto diff --git a/cron/data/projects.csv b/cron/internal/data/projects.csv similarity index 100% rename from cron/data/projects.csv rename to cron/internal/data/projects.csv diff --git a/cron/data/request.pb.go b/cron/internal/data/request.pb.go similarity index 100% rename from cron/data/request.pb.go rename to cron/internal/data/request.pb.go diff --git a/cron/data/request.proto b/cron/internal/data/request.proto similarity index 100% rename from cron/data/request.proto rename to cron/internal/data/request.proto diff --git a/cron/data/testdata/basic.csv b/cron/internal/data/testdata/basic.csv similarity index 100% rename from cron/data/testdata/basic.csv rename to cron/internal/data/testdata/basic.csv diff --git a/cron/data/testdata/comment.csv b/cron/internal/data/testdata/comment.csv similarity index 100% rename from cron/data/testdata/comment.csv rename to cron/internal/data/testdata/comment.csv diff --git a/cron/data/testdata/empty_row.csv b/cron/internal/data/testdata/empty_row.csv similarity index 100% rename from cron/data/testdata/empty_row.csv rename to cron/internal/data/testdata/empty_row.csv diff --git a/cron/data/testdata/extra_column.csv b/cron/internal/data/testdata/extra_column.csv similarity index 100% rename from cron/data/testdata/extra_column.csv rename to cron/internal/data/testdata/extra_column.csv diff --git a/cron/data/testdata/failing_urls.csv b/cron/internal/data/testdata/failing_urls.csv similarity index 100% rename from cron/data/testdata/failing_urls.csv rename to cron/internal/data/testdata/failing_urls.csv diff --git a/cron/data/update/dependency.go b/cron/internal/data/update/dependency.go similarity index 99% rename from cron/data/update/dependency.go rename to cron/internal/data/update/dependency.go index b8cc11c3725..79b5fe65f5e 100644 --- a/cron/data/update/dependency.go +++ b/cron/internal/data/update/dependency.go @@ -30,7 +30,7 @@ import ( "golang.org/x/tools/go/vcs" "github.com/ossf/scorecard/v4/clients/githubrepo" - "github.com/ossf/scorecard/v4/cron/data" + "github.com/ossf/scorecard/v4/cron/internal/data" ) var ( diff --git a/cron/data/update/main.go b/cron/internal/data/update/main.go similarity index 96% rename from cron/data/update/main.go rename to cron/internal/data/update/main.go index 7e8eb2e05c7..8b5df908272 100644 --- a/cron/data/update/main.go +++ b/cron/internal/data/update/main.go @@ -19,7 +19,7 @@ import ( "bytes" "os" - "github.com/ossf/scorecard/v4/cron/data" + "github.com/ossf/scorecard/v4/cron/internal/data" ) // Adds "project=${PROJECT},dependency=true" to the repositories metadata. diff --git a/cron/data/validate/main.go b/cron/internal/data/validate/main.go similarity index 96% rename from cron/data/validate/main.go rename to cron/internal/data/validate/main.go index aeb8141badc..47ddac04ecc 100644 --- a/cron/data/validate/main.go +++ b/cron/internal/data/validate/main.go @@ -19,7 +19,7 @@ import ( "log" "os" - "github.com/ossf/scorecard/v4/cron/data" + "github.com/ossf/scorecard/v4/cron/internal/data" ) // Validates data.Iterator used by production PubSub cron job. diff --git a/cron/data/writer.go b/cron/internal/data/writer.go similarity index 100% rename from cron/data/writer.go rename to cron/internal/data/writer.go diff --git a/cron/data/writer_test.go b/cron/internal/data/writer_test.go similarity index 100% rename from cron/data/writer_test.go rename to cron/internal/data/writer_test.go diff --git a/cron/format/bq.raw.schema b/cron/internal/format/bq.raw.schema similarity index 100% rename from cron/format/bq.raw.schema rename to cron/internal/format/bq.raw.schema diff --git a/cron/format/json.go b/cron/internal/format/json.go similarity index 100% rename from cron/format/json.go rename to cron/internal/format/json.go diff --git a/cron/format/json.raw.schema b/cron/internal/format/json.raw.schema similarity index 100% rename from cron/format/json.raw.schema rename to cron/internal/format/json.raw.schema diff --git a/cron/format/json.v2.schema b/cron/internal/format/json.v2.schema similarity index 100% rename from cron/format/json.v2.schema rename to cron/internal/format/json.v2.schema diff --git a/cron/format/json_raw_results.go b/cron/internal/format/json_raw_results.go similarity index 100% rename from cron/format/json_raw_results.go rename to cron/internal/format/json_raw_results.go diff --git a/cron/format/json_test.go b/cron/internal/format/json_test.go similarity index 100% rename from cron/format/json_test.go rename to cron/internal/format/json_test.go diff --git a/cron/format/mock_doc.go b/cron/internal/format/mock_doc.go similarity index 100% rename from cron/format/mock_doc.go rename to cron/internal/format/mock_doc.go diff --git a/cron/format/schema_gen.go b/cron/internal/format/schema_gen.go similarity index 100% rename from cron/format/schema_gen.go rename to cron/internal/format/schema_gen.go diff --git a/cron/format/schema_gen_test.go b/cron/internal/format/schema_gen_test.go similarity index 100% rename from cron/format/schema_gen_test.go rename to cron/internal/format/schema_gen_test.go diff --git a/cron/format/testdata/bq-valid.schema b/cron/internal/format/testdata/bq-valid.schema similarity index 100% rename from cron/format/testdata/bq-valid.schema rename to cron/internal/format/testdata/bq-valid.schema diff --git a/cron/format/testdata/check1.json b/cron/internal/format/testdata/check1.json similarity index 100% rename from cron/format/testdata/check1.json rename to cron/internal/format/testdata/check1.json diff --git a/cron/format/testdata/check2.json b/cron/internal/format/testdata/check2.json similarity index 100% rename from cron/format/testdata/check2.json rename to cron/internal/format/testdata/check2.json diff --git a/cron/format/testdata/check3.json b/cron/internal/format/testdata/check3.json similarity index 100% rename from cron/format/testdata/check3.json rename to cron/internal/format/testdata/check3.json diff --git a/cron/format/testdata/check4.json b/cron/internal/format/testdata/check4.json similarity index 100% rename from cron/format/testdata/check4.json rename to cron/internal/format/testdata/check4.json diff --git a/cron/format/testdata/check5.json b/cron/internal/format/testdata/check5.json similarity index 100% rename from cron/format/testdata/check5.json rename to cron/internal/format/testdata/check5.json diff --git a/cron/format/testdata/check6.json b/cron/internal/format/testdata/check6.json similarity index 100% rename from cron/format/testdata/check6.json rename to cron/internal/format/testdata/check6.json diff --git a/cron/format/testdata/valid.schema b/cron/internal/format/testdata/valid.schema similarity index 100% rename from cron/format/testdata/valid.schema rename to cron/internal/format/testdata/valid.schema diff --git a/cron/monitoring/exporter.go b/cron/internal/monitoring/exporter.go similarity index 98% rename from cron/monitoring/exporter.go rename to cron/internal/monitoring/exporter.go index b5d769729dc..b7ecb8efeab 100644 --- a/cron/monitoring/exporter.go +++ b/cron/internal/monitoring/exporter.go @@ -24,7 +24,7 @@ import ( "contrib.go.opencensus.io/exporter/stackdriver/monitoredresource/gcp" "go.opencensus.io/stats/view" - "github.com/ossf/scorecard/v4/cron/config" + "github.com/ossf/scorecard/v4/cron/internal/config" ) var errorUndefinedExporter = errors.New("unsupported exporterType") diff --git a/cron/monitoring/printer.go b/cron/internal/monitoring/printer.go similarity index 100% rename from cron/monitoring/printer.go rename to cron/internal/monitoring/printer.go diff --git a/cron/pubsub/publisher.go b/cron/internal/pubsub/publisher.go similarity index 97% rename from cron/pubsub/publisher.go rename to cron/internal/pubsub/publisher.go index 6310e166ef9..fc4200497c1 100644 --- a/cron/pubsub/publisher.go +++ b/cron/internal/pubsub/publisher.go @@ -28,7 +28,7 @@ import ( _ "gocloud.dev/pubsub/gcppubsub" "google.golang.org/protobuf/encoding/protojson" - "github.com/ossf/scorecard/v4/cron/data" + "github.com/ossf/scorecard/v4/cron/internal/data" ) var errorPublish = errors.New("total errors when publishing") diff --git a/cron/pubsub/publisher_test.go b/cron/internal/pubsub/publisher_test.go similarity index 97% rename from cron/pubsub/publisher_test.go rename to cron/internal/pubsub/publisher_test.go index 0c9ec24c1e6..1bec7171ef2 100644 --- a/cron/pubsub/publisher_test.go +++ b/cron/internal/pubsub/publisher_test.go @@ -21,7 +21,7 @@ import ( "gocloud.dev/pubsub" - "github.com/ossf/scorecard/v4/cron/data" + "github.com/ossf/scorecard/v4/cron/internal/data" ) type mockSucceedTopic struct{} diff --git a/cron/pubsub/subscriber.go b/cron/internal/pubsub/subscriber.go similarity index 96% rename from cron/pubsub/subscriber.go rename to cron/internal/pubsub/subscriber.go index 86ecff60d9a..fcca1a51cd0 100644 --- a/cron/pubsub/subscriber.go +++ b/cron/internal/pubsub/subscriber.go @@ -21,7 +21,7 @@ import ( "google.golang.org/protobuf/encoding/protojson" - "github.com/ossf/scorecard/v4/cron/data" + "github.com/ossf/scorecard/v4/cron/internal/data" ) // ErrorInParse indicates there was an error while unmarshalling the protocol buffer message. diff --git a/cron/pubsub/subscriber_gcs.go b/cron/internal/pubsub/subscriber_gcs.go similarity index 98% rename from cron/pubsub/subscriber_gcs.go rename to cron/internal/pubsub/subscriber_gcs.go index 8af766a4c7b..a4dcd5535bd 100644 --- a/cron/pubsub/subscriber_gcs.go +++ b/cron/internal/pubsub/subscriber_gcs.go @@ -24,7 +24,7 @@ import ( pubsub "cloud.google.com/go/pubsub/apiv1" pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" - "github.com/ossf/scorecard/v4/cron/data" + "github.com/ossf/scorecard/v4/cron/internal/data" ) const ( diff --git a/cron/pubsub/subscriber_gocloud.go b/cron/internal/pubsub/subscriber_gocloud.go similarity index 97% rename from cron/pubsub/subscriber_gocloud.go rename to cron/internal/pubsub/subscriber_gocloud.go index 91e50ded736..acb5fa111aa 100644 --- a/cron/pubsub/subscriber_gocloud.go +++ b/cron/internal/pubsub/subscriber_gocloud.go @@ -23,7 +23,7 @@ import ( // Needed to link in GCP drivers. _ "gocloud.dev/pubsub/gcppubsub" - "github.com/ossf/scorecard/v4/cron/data" + "github.com/ossf/scorecard/v4/cron/internal/data" ) type receiver interface { diff --git a/cron/pubsub/subscriber_gocloud_test.go b/cron/internal/pubsub/subscriber_gocloud_test.go similarity index 98% rename from cron/pubsub/subscriber_gocloud_test.go rename to cron/internal/pubsub/subscriber_gocloud_test.go index b9541280e9b..b4d5199f4d0 100644 --- a/cron/pubsub/subscriber_gocloud_test.go +++ b/cron/internal/pubsub/subscriber_gocloud_test.go @@ -23,7 +23,7 @@ import ( "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" - "github.com/ossf/scorecard/v4/cron/data" + "github.com/ossf/scorecard/v4/cron/internal/data" ) var repo1 = "repo1" diff --git a/cron/shuffle/main.go b/cron/internal/shuffle/main.go similarity index 96% rename from cron/shuffle/main.go rename to cron/internal/shuffle/main.go index 805b0c189d7..671f8f0f4df 100644 --- a/cron/shuffle/main.go +++ b/cron/internal/shuffle/main.go @@ -21,7 +21,7 @@ import ( "strconv" "time" - "github.com/ossf/scorecard/v4/cron/data" + "github.com/ossf/scorecard/v4/cron/internal/data" ) func main() { diff --git a/cron/webhook/Dockerfile b/cron/internal/webhook/Dockerfile similarity index 88% rename from cron/webhook/Dockerfile rename to cron/internal/webhook/Dockerfile index a4290affed9..377d99523e6 100644 --- a/cron/webhook/Dockerfile +++ b/cron/internal/webhook/Dockerfile @@ -25,5 +25,5 @@ ARG TARGETARCH RUN CGO_ENABLED=0 make build-webhook FROM gcr.io/distroless/base:nonroot@sha256:d65ac1a65a4d82a48ebd0a22aea2acdd95d7abeeda245dfee932ec0018c781f4 -COPY --from=webhook /src/cron/webhook/webhook cron/webhook/webhook -ENTRYPOINT ["cron/webhook/webhook"] +COPY --from=webhook /src/cron/internal/webhook/webhook cron/internal/webhook/webhook +ENTRYPOINT ["cron/internal/webhook/webhook"] diff --git a/cron/webhook/main.go b/cron/internal/webhook/main.go similarity index 98% rename from cron/webhook/main.go rename to cron/internal/webhook/main.go index 3f69121b1ca..b6fc889ac99 100644 --- a/cron/webhook/main.go +++ b/cron/internal/webhook/main.go @@ -26,7 +26,7 @@ import ( "github.com/google/go-containerregistry/pkg/v1/google" "google.golang.org/protobuf/encoding/protojson" - "github.com/ossf/scorecard/v4/cron/data" + "github.com/ossf/scorecard/v4/cron/internal/data" ) const stableTag = "stable" diff --git a/cron/worker/Dockerfile b/cron/internal/worker/Dockerfile similarity index 88% rename from cron/worker/Dockerfile rename to cron/internal/worker/Dockerfile index 5125079b520..48cdb221f87 100644 --- a/cron/worker/Dockerfile +++ b/cron/internal/worker/Dockerfile @@ -25,5 +25,5 @@ ARG TARGETARCH RUN CGO_ENABLED=0 make build-worker FROM gcr.io/distroless/base:nonroot@sha256:d65ac1a65a4d82a48ebd0a22aea2acdd95d7abeeda245dfee932ec0018c781f4 -COPY --from=worker /src/cron/worker/worker cron/worker/worker -ENTRYPOINT ["cron/worker/worker"] +COPY --from=worker /src/cron/internal/worker/worker cron/internal/worker/worker +ENTRYPOINT ["cron/internal/worker/worker"] diff --git a/cron/worker/main.go b/cron/internal/worker/main.go similarity index 96% rename from cron/worker/main.go rename to cron/internal/worker/main.go index e5850bc29ad..e539a8c20a8 100644 --- a/cron/worker/main.go +++ b/cron/internal/worker/main.go @@ -30,11 +30,11 @@ import ( "github.com/ossf/scorecard/v4/clients" "github.com/ossf/scorecard/v4/clients/githubrepo" githubstats "github.com/ossf/scorecard/v4/clients/githubrepo/stats" - "github.com/ossf/scorecard/v4/cron/config" - "github.com/ossf/scorecard/v4/cron/data" - format "github.com/ossf/scorecard/v4/cron/format" - "github.com/ossf/scorecard/v4/cron/monitoring" - "github.com/ossf/scorecard/v4/cron/pubsub" + "github.com/ossf/scorecard/v4/cron/internal/config" + "github.com/ossf/scorecard/v4/cron/internal/data" + format "github.com/ossf/scorecard/v4/cron/internal/format" + "github.com/ossf/scorecard/v4/cron/internal/monitoring" + "github.com/ossf/scorecard/v4/cron/internal/pubsub" docs "github.com/ossf/scorecard/v4/docs/checks" sce "github.com/ossf/scorecard/v4/errors" "github.com/ossf/scorecard/v4/log"