From 88e5ff7f11b5bb8a5448c73fe18a4a76c1ea06bd Mon Sep 17 00:00:00 2001 From: Azeem Shaikh Date: Thu, 22 Sep 2022 16:25:54 -0400 Subject: [PATCH] Improve API limiting and cache (#2294) Signed-off-by: Azeem Shaikh Signed-off-by: Azeem Shaikh --- .github/workflows/docker.yml | 14 ++++++++++++++ .github/workflows/main.yml | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index cadd6cc34b4..99c7b2145a8 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -49,6 +49,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 #v2.1.7 @@ -75,6 +76,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: docker build run: make scorecard-docker cron-controller: @@ -92,6 +94,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 #v2.1.7 @@ -118,6 +121,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: docker build run: make cron-controller-docker cron-worker: @@ -135,6 +139,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 #v2.1.7 @@ -161,6 +166,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: docker build run: make cron-worker-docker cron-cii-worker: @@ -178,6 +184,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 #v2.1.7 @@ -204,6 +211,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: docker build run: make cron-cii-worker-docker cron-bq-transfer: @@ -221,6 +229,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 #v2.1.7 @@ -247,6 +256,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: docker build run: make cron-bq-transfer-docker cron-webhook: @@ -264,6 +274,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 #v2.1.7 @@ -290,6 +301,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: docker build run: make cron-webhook-docker cron-github-server: @@ -307,6 +319,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 #v2.1.7 @@ -333,5 +346,6 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: docker build run: make cron-github-server-docker diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index abf000571b0..1b89a6ca9b8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -62,6 +62,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: Run unit-tests run: make unit-test - name: Upload codecoverage @@ -106,6 +107,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: generate mocks uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -131,6 +133,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # v2.1.7 @@ -152,6 +155,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: generate docs uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -176,6 +180,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Clone the code uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2.3.4 with: @@ -185,6 +190,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: build-proto uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -210,6 +216,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # v2.1.7 @@ -231,6 +238,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: Run build uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -256,6 +264,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # v2.1.7 @@ -277,6 +286,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: build cron uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -302,6 +312,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # v2.1.7 @@ -323,6 +334,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: build worker uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -348,6 +360,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # v2.1.7 @@ -369,6 +382,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: build cii-worker uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -394,6 +408,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # v2.1.7 @@ -415,6 +430,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: build shuffler uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -440,6 +456,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # v2.1.7 @@ -461,6 +478,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: build bq transfer uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -486,6 +504,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # v2.1.7 @@ -507,6 +526,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: build bq transfer uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -532,6 +552,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # v2.1.7 @@ -553,6 +574,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: build webhook uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -578,6 +600,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # v2.1.7 @@ -599,6 +622,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: build-add-script uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -624,6 +648,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # v2.1.7 @@ -645,6 +670,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: build-validate-script uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -670,6 +696,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # v2.1.7 @@ -691,6 +718,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: build-validate-script uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -715,6 +743,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Clone the code uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2.3.4 with: @@ -724,6 +753,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: Run build run: | go env -w GOFLAGS=-mod=mod @@ -760,6 +790,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: Run build uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -784,6 +815,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Cache builds # https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds uses: actions/cache@fd5de65bc895cf536527842281bea11763fefd77 # v2.1.7 @@ -805,6 +837,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: Run build uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -829,6 +862,7 @@ jobs: uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 with: version: ${{ env.PROTOC_VERSION }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Clone the code uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2.3.4 with: @@ -838,6 +872,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: Run build uses: nick-invision/retry@b4fa57557dda8c2f30bcb2d19372cc3237190f7f with: @@ -863,6 +898,7 @@ jobs: with: go-version: ${{ env.GO_VERSION }} check-latest: true + cache: true - name: Check license headers run: | go env -w GOFLAGS=-mod=mod