From 3f6f3970c856cbc32cc61ecb08a0b197554d81c2 Mon Sep 17 00:00:00 2001 From: Shahzad Lone Date: Mon, 22 Jan 2024 05:07:28 -0500 Subject: [PATCH] PR: Resolve all YAML lint errors --- .github/dependabot.yml | 2 +- .github/workflows/build-then-deploy-ami.yml | 2 +- .github/workflows/combine-bot-prs.yml | 41 +++++++---- .github/workflows/lint-then-benchmark.yml | 3 +- .../preview-ami-with-terraform-plan.yml | 2 +- .../workflows/test-and-upload-coverage.yml | 2 +- .github/workflows/validate-containerfile.yml | 1 - .goreleaser.yaml | 68 +++++++++++-------- tools/cloud/akash/deploy.yaml | 6 +- 9 files changed, 77 insertions(+), 50 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e48d4303f1..577198d399 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -15,4 +15,4 @@ updates: labels: - "dependencies" commit-message: - prefix: "bot" \ No newline at end of file + prefix: "bot" diff --git a/.github/workflows/build-then-deploy-ami.yml b/.github/workflows/build-then-deploy-ami.yml index ce6be1e0bd..4423d70659 100644 --- a/.github/workflows/build-then-deploy-ami.yml +++ b/.github/workflows/build-then-deploy-ami.yml @@ -109,7 +109,7 @@ jobs: - name: Terraform validation run: terraform validate -no-color - - name: List workspaces + - name: List workspaces run: ls workspaces - name: Terraform Apply diff --git a/.github/workflows/combine-bot-prs.yml b/.github/workflows/combine-bot-prs.yml index 59a7910ced..c559240eac 100644 --- a/.github/workflows/combine-bot-prs.yml +++ b/.github/workflows/combine-bot-prs.yml @@ -44,12 +44,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/github-script@v6 + - name: Set current date as env variable + run: echo "CURRENT_DATE=$(date +'%d-%m-%Y')" >> ${GITHUB_ENV} + - name: Create combined pr id: create-combined-pr - - name: Create combined pr - + uses: actions/github-script@v6 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | @@ -66,7 +66,11 @@ jobs: if (branch.startsWith('${{ github.event.inputs.branchPrefix }}')) { console.log('Branch matched prefix: ' + branch); let statusOK = true; - if(${{ github.event.inputs.mustBeGreen }}) { + if ($ { + { + github.event.inputs.mustBeGreen + } + }) { console.log('Checking green status: ' + branch); const stateQuery = `query($owner: String!, $repo: String!, $pull_number: Int!) { repository(owner: $owner, name: $repo) { @@ -89,20 +93,22 @@ jobs: pull_number: pull['number'] }; const result = await github.graphql(stateQuery, vars); - const [{ commit }] = result.repository.pullRequest.commits.nodes; + const [{ + commit + }] = result.repository.pullRequest.commits.nodes; const state = commit.statusCheckRollup.state console.log('Validating status: ' + state); - if(state != 'SUCCESS') { + if (state != 'SUCCESS') { console.log('Discarding ' + branch + ' with status ' + state); statusOK = false; } } console.log('Checking labels: ' + branch); const labels = pull['labels']; - for(const label of labels) { + for (const label of labels) { const labelName = label['name']; console.log('Checking label: ' + labelName); - if(labelName == '${{ github.event.inputs.ignoreLabel }}') { + if (labelName == '${{ github.event.inputs.ignoreLabel }}') { console.log('Discarding ' + branch + ' with label ' + labelName); statusOK = false; } @@ -110,7 +116,10 @@ jobs: if (statusOK) { console.log('Adding branch to array: ' + branch); const prString = '#' + pull['number'] + ' ' + pull['title']; - branchesAndPRStrings.push({ branch, prString }); + branchesAndPRStrings.push({ + branch, + prString + }); baseBranch = pull['base']['ref']; baseBranchSHA = pull['base']['sha']; } @@ -135,7 +144,11 @@ jobs: let combinedPRs = []; let mergeFailedPRs = []; - for(const { branch, prString } of branchesAndPRStrings) { + for (const { + branch, + prString + } + of branchesAndPRStrings) { try { await github.rest.repos.merge({ owner: context.repo.owner, @@ -153,15 +166,15 @@ jobs: console.log('Creating combined PR'); const combinedPRsString = combinedPRs.join('\n'); - let body = '✅ This PR was created by the Combine PRs action by combining the following PRs:\n' + combinedPRsString; - if(mergeFailedPRs.length > 0) { + let body = '✅ This PR was created by combining the following PRs:\n' + combinedPRsString; + if (mergeFailedPRs.length > 0) { const mergeFailedPRsString = mergeFailedPRs.join('\n'); body += '\n\n⚠️ The following PRs were left out due to merge conflicts:\n' + mergeFailedPRsString } await github.rest.pulls.create({ owner: context.repo.owner, repo: context.repo.repo, - title: 'bot: Combined PRs', + title: 'bot: Update dependencies (bulk dependabot PRs) ${CURRENT_DATE}', head: '${{ github.event.inputs.combineBranchName }}', base: baseBranch, body: body diff --git a/.github/workflows/lint-then-benchmark.yml b/.github/workflows/lint-then-benchmark.yml index a251e24fa5..c984cce3ef 100644 --- a/.github/workflows/lint-then-benchmark.yml +++ b/.github/workflows/lint-then-benchmark.yml @@ -270,7 +270,8 @@ jobs: github.event_name == 'pull_request' && github.base_ref == 'develop' run: > - ${GOPATH}/bin/benchstat -html -alpha 1.1 develop.txt current.txt | sed -n "//,/<\/body>/p" > comparison.html && + ${GOPATH}/bin/benchstat -html -alpha 1.1 develop.txt current.txt | + sed -n "//,/<\/body>/p" > comparison.html && ./tools/scripts/pretty-benchstat-html.sh comparison.html > pretty-comparison.md - name: Comment Benchmark Results on PR diff --git a/.github/workflows/preview-ami-with-terraform-plan.yml b/.github/workflows/preview-ami-with-terraform-plan.yml index ed2fef6f0c..25e975a247 100644 --- a/.github/workflows/preview-ami-with-terraform-plan.yml +++ b/.github/workflows/preview-ami-with-terraform-plan.yml @@ -131,5 +131,5 @@ jobs: if: steps.terraform-plan.outcome == 'failure' run: exit 1 - - name: List workspaces + - name: List workspaces run: ls workspaces diff --git a/.github/workflows/test-and-upload-coverage.yml b/.github/workflows/test-and-upload-coverage.yml index 38bcedd95c..60858b1f86 100644 --- a/.github/workflows/test-and-upload-coverage.yml +++ b/.github/workflows/test-and-upload-coverage.yml @@ -105,7 +105,7 @@ jobs: needs: run-tests - # Important to know: + # Important to know: # - We didn't use `if: always()` here, so this job doesn't run if we manually canceled. # - `if: success()` is always implied unless `always()` or `failure()` is specified. if: success() || failure() diff --git a/.github/workflows/validate-containerfile.yml b/.github/workflows/validate-containerfile.yml index b3315861ad..260e0dba89 100644 --- a/.github/workflows/validate-containerfile.yml +++ b/.github/workflows/validate-containerfile.yml @@ -54,4 +54,3 @@ jobs: - name: Test Docker image run: docker run --rm ${{ env.TEST_TAG }} - diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 119447d180..2d3db05fa6 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -15,7 +15,7 @@ builds: goarch: - amd64 - arm64 - # A build with the playground included. + # A build with the playground included. - id: "defradb_playground" main: ./cmd/defradb flags: @@ -27,30 +27,45 @@ builds: goarch: - amd64 - arm64 - + partial: by: target archives: - id: defradb_playground - builds: + builds: - defradb_playground format: binary # this name template makes the OS and Arch compatible with the results of `uname`. - name_template: '{{ .Binary }}_playground_{{ .Version }}_{{ .Os }}_{{- if eq .Arch "amd64" }}x86_64{{- else }}{{ .Arch }}{{ end }}{{- if .Arm }}v{{ .Arm }}{{ end }}' + name_template: >- + {{ .Binary }}_playground_{{ .Version }}_{{ .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} - id: defradb - builds: + builds: - defradb format: binary # this name template makes the OS and Arch compatible with the results of `uname`. - name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{- if eq .Arch "amd64" }}x86_64{{- else }}{{ .Arch }}{{ end }}{{- if .Arm }}v{{ .Arm }}{{ end }}' + name_template: >- + {{ .Binary }}_{{ .Version }}_{{ .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} release: target_commitish: '{{ .Commit }}' - header: | - DefraDB v{{ .Major }}.{{ .Minor }} is a major pre-production release. Until the stable version 1.0 is reached, the SemVer minor patch number will denote notable releases, which will give the project freedom to experiment and explore potentially breaking changes. + header: > + DefraDB v{{ .Major }}.{{ .Minor }} is a major pre-production release. + Until the stable version 1.0 is reached, + the SemVer minor patch number will denote notable releases, + which will give the project freedom to experiment and explore potentially breaking changes. + + To get a full outline of the changes, we invite you to review the official changelog below. + This release does include a Breaking Change to existing v{{ .Major }}.{{ .Minor }}.x databases. + If you need help migrating an existing deployment, + reach out at hello@source.network or join our Discord at https://discord.gg/w7jYQVJ/. - To get a full outline of the changes, we invite you to review the official changelog below. This release does include a Breaking Change to existing v{{ .Major }}.{{ .Minor }}.x databases. If you need help migrating an existing deployment, reach out at hello@source.network or join our Discord at https://discord.gg/w7jYQVJ/. name_template: "v{{ .Version }} Release" changelog: @@ -85,21 +100,20 @@ milestones: name_template: "DefraDB v{{ .Major }}.{{ .Minor }}" dockers: -- ids: - - "defradb_playground" - image_templates: - - "{{ .Env.GITHUB_REPOSITORY }}:latest" - - "{{ .Env.GITHUB_REPOSITORY }}:{{ .Version }}" - - "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}:{{ .Version }}" - use: buildx - build_flag_templates: - - "--pull" - - "--label=org.opencontainers.image.description=DefraDB is a Peer-to-Peer Edge Database." - - "--label=org.opencontainers.image.created={{ .Date }}" - - "--label=org.opencontainers.image.name={{ .ProjectName }}" - - "--label=org.opencontainers.image.revision={{ .FullCommit }}" - - "--label=org.opencontainers.image.version={{ .Version }}" - - "--label=org.opencontainers.image.source={{ .GitURL }}" - - "--platform=linux/amd64" - dockerfile: ./tools/goreleaser.containerfile - + - ids: + - "defradb_playground" + image_templates: + - "{{ .Env.GITHUB_REPOSITORY }}:latest" + - "{{ .Env.GITHUB_REPOSITORY }}:{{ .Version }}" + - "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}:{{ .Version }}" + use: buildx + build_flag_templates: + - "--pull" + - "--label=org.opencontainers.image.description=DefraDB is a Peer-to-Peer Edge Database." + - "--label=org.opencontainers.image.created={{ .Date }}" + - "--label=org.opencontainers.image.name={{ .ProjectName }}" + - "--label=org.opencontainers.image.revision={{ .FullCommit }}" + - "--label=org.opencontainers.image.version={{ .Version }}" + - "--label=org.opencontainers.image.source={{ .GitURL }}" + - "--platform=linux/amd64" + dockerfile: ./tools/goreleaser.containerfile diff --git a/tools/cloud/akash/deploy.yaml b/tools/cloud/akash/deploy.yaml index c6f7070f98..48d86fff8b 100644 --- a/tools/cloud/akash/deploy.yaml +++ b/tools/cloud/akash/deploy.yaml @@ -5,7 +5,7 @@ services: defradb: image: sourcenetwork/defradb:v0.6.0 args: - - start + - start - --url=0.0.0.0:9181 expose: - port: 9161 @@ -40,7 +40,7 @@ profiles: - "akash1365yvmc4s7awdyj3n2sav7xfx76adc6dnmlx63" - "akash18qa2a2ltfyvkyj0ggj3hkvuj6twzyumuaru9s4" pricing: - defradb: + defradb: denom: uakt amount: 10000 @@ -48,4 +48,4 @@ deployment: defradb: akash: profile: defradb - count: 1 \ No newline at end of file + count: 1