From 1d0c93f047f4bb412355f02c1a92c8f167f273aa Mon Sep 17 00:00:00 2001 From: Sam <109683132+kernelsam@users.noreply.github.com> Date: Mon, 8 Jan 2024 19:49:36 -0800 Subject: [PATCH] #63 post migration cleanup (#73) * #70 remove garage project * update org vars * revert change * cleanup * cleanup * cleanup * tmp test * add yamllint * standardization, remove doc start * add default yamllint config * make linter reusable * cleanup --- .github/ISSUE_TEMPLATE/bug_report.md | 40 ----- .../ISSUE_TEMPLATE/documentation_request.md | 28 --- .github/ISSUE_TEMPLATE/feature_request.md | 19 -- .github/linters/.yaml-lint.yml | 11 ++ .github/workflows/add-labels-to-issue.yaml | 2 - .github/workflows/add-to-project.yaml | 2 - .../dependabot-approve-and-merge.yaml | 2 - .github/workflows/dependabot-automation.yaml | 18 +- ...-push-containers-to-dockerhub-and-ecr.yaml | 166 +++++++++--------- .github/workflows/gofmt.yaml | 2 - .github/workflows/issue-automation.yaml | 6 +- .github/workflows/lint-repo.yaml | 11 ++ .github/workflows/linter.yaml | 21 +-- .github/workflows/make-go-github-file.yaml | 2 - .github/workflows/move-pr-to-done.yaml | 9 +- .github/workflows/pr-closed-automation.yaml | 4 +- PULL_REQUEST_TEMPLATE.md | 13 -- 17 files changed, 129 insertions(+), 227 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/documentation_request.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/linters/.yaml-lint.yml create mode 100644 .github/workflows/lint-repo.yaml delete mode 100644 PULL_REQUEST_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 1f1148a..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,40 +0,0 @@ -# Bug Reporting - ---- -name: Bug report -about: Create a report to help us improve - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: - -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - -- OS: [e.g. iOS] -- Browser [e.g. chrome, safari] -- Version [e.g. 22] - -**Mobile phone (please complete the following information):** - -- Device: [e.g. iPhone6] -- OS: [e.g. iOS8.1] -- Browser [e.g. stock browser, safari] -- Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/documentation_request.md b/.github/ISSUE_TEMPLATE/documentation_request.md deleted file mode 100644 index 59e71c6..0000000 --- a/.github/ISSUE_TEMPLATE/documentation_request.md +++ /dev/null @@ -1,28 +0,0 @@ -# Documentation Requests - ---- -name: Documentation request -about: Identify an area for improvement in documentation - ---- - -**What is the URL of the documentation?** - -- **Example:** - + *Note:* This URL includes the web page and the section of the documentation. - -**What can be improved?** - -A clear and concise description of what can be improved. -Examples: - -- "I don't understand where the ${XYZ} variable is set." -- "There seems to be a step missing between 'X' and 'Z'. I don't know how to get to 'Z'." -- "When I run `command sub-command ...` I get the following error:" -- "I don't know what is meant by 'gerble barb gazoink` in the instructions". - -**Additional context** - -Add any other context or screenshots to help describe the documentation improvement. -If you think the documentation improvement is operating system specific, -please indicate which operating system is being used. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 8a32685..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,19 +0,0 @@ -# Feature Requests - ---- -name: Feature request -about: Suggest an idea for this project - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml new file mode 100644 index 0000000..e9bfd1f --- /dev/null +++ b/.github/linters/.yaml-lint.yml @@ -0,0 +1,11 @@ +--- + +# Extends the default yamllint config by adjusting some options. +extends: default + +rules: + comments-indentation: disable + line-length: + level: warning + allow-non-breakable-inline-mappings: true + truthy: disable \ No newline at end of file diff --git a/.github/workflows/add-labels-to-issue.yaml b/.github/workflows/add-labels-to-issue.yaml index b414f5e..7fbf8c7 100644 --- a/.github/workflows/add-labels-to-issue.yaml +++ b/.github/workflows/add-labels-to-issue.yaml @@ -1,5 +1,3 @@ ---- - name: 'add labels to issue' on: diff --git a/.github/workflows/add-to-project.yaml b/.github/workflows/add-to-project.yaml index b6c6be8..1519d33 100644 --- a/.github/workflows/add-to-project.yaml +++ b/.github/workflows/add-to-project.yaml @@ -1,5 +1,3 @@ ---- - name: 'add to project' on: diff --git a/.github/workflows/dependabot-approve-and-merge.yaml b/.github/workflows/dependabot-approve-and-merge.yaml index 5174100..10e7f76 100644 --- a/.github/workflows/dependabot-approve-and-merge.yaml +++ b/.github/workflows/dependabot-approve-and-merge.yaml @@ -1,5 +1,3 @@ ---- - name: 'dependabot approve and merge' on: diff --git a/.github/workflows/dependabot-automation.yaml b/.github/workflows/dependabot-automation.yaml index 25c6eb6..573a0ee 100644 --- a/.github/workflows/dependabot-automation.yaml +++ b/.github/workflows/dependabot-automation.yaml @@ -1,6 +1,4 @@ ---- - -name: dependabot automation +name: 'dependabot automation' on: pull_request: @@ -8,21 +6,13 @@ on: jobs: - add-pr-to-community: - if: ${{ github.actor == 'dependabot[bot]' && ( github.event.action == 'opened' || github.event.action == 'reopened' ) }} - uses: senzing-factory/build-resources/.github/workflows/add-to-project.yaml@main - with: - project-number: "2" - classic: true - secrets: - SENZING_GITHUB_ACCESS_TOKEN: ${{ secrets.SENZING_GITHUB_ACCESS_TOKEN }} - - add-pr-to-devsecops: + add-pr-to-project: if: ${{ github.actor == 'dependabot[bot]' && ( github.event.action == 'opened' || github.event.action == 'reopened' ) }} uses: senzing-factory/build-resources/.github/workflows/add-to-project.yaml@main with: - project-number: "13" classic: false + org: ${{ vars.SENZING_GITHUB_ACCOUNT_NAME }} + project-number: ${{ vars.SENZING_PROJECT_FACTORY }} secrets: SENZING_GITHUB_PROJECT_RW_TOKEN: ${{ secrets.SENZING_GITHUB_PROJECT_RW_TOKEN }} diff --git a/.github/workflows/docker-push-containers-to-dockerhub-and-ecr.yaml b/.github/workflows/docker-push-containers-to-dockerhub-and-ecr.yaml index bd74ba2..227404d 100644 --- a/.github/workflows/docker-push-containers-to-dockerhub-and-ecr.yaml +++ b/.github/workflows/docker-push-containers-to-dockerhub-and-ecr.yaml @@ -1,96 +1,94 @@ ---- - name: 'docker-push-containers-to-dockerhub-and-ecr' on: - workflow_call: - inputs: - build-options: - description: Additional options to pass to docker buildx build - type: string - context: - default: "." - description: Context (directory) of the docker build process - type: string - docker-image-repository: - description: Docker repository (e.g. senzing/senzingapi-runtime) - required: true - type: string - docker-registry-server: - default: docker.io - description: Docker registry server - type: string - ecr-image-repository: - description: ECR repository (e.g. senzing/senzingapi-runtime) - required: true - type: string - image-tag: - default: latest - description: Docker image tag - type: string - platforms: - default: "linux/amd64" - type: string + workflow_call: + inputs: + build-options: + description: Additional options to pass to docker buildx build + type: string + context: + default: "." + description: Context (directory) of the docker build process + type: string + docker-image-repository: + description: Docker repository (e.g. senzing/senzingapi-runtime) + required: true + type: string + docker-registry-server: + default: docker.io + description: Docker registry server + type: string + ecr-image-repository: + description: ECR repository (e.g. senzing/senzingapi-runtime) + required: true + type: string + image-tag: + default: latest + description: Docker image tag + type: string + platforms: + default: "linux/amd64" + type: string - secrets: - AWS_DOCKER_ACCOUNT_ID: - required: true - DOCKERHUB_ACCESS_TOKEN: - required: true - DOCKERHUB_USERNAME: - required: true + secrets: + AWS_DOCKER_ACCOUNT_ID: + required: true + DOCKERHUB_ACCESS_TOKEN: + required: true + DOCKERHUB_USERNAME: + required: true jobs: - docker-push-containers-to-dockerhub-and-ecr: - runs-on: ubuntu-latest - permissions: - id-token: write # This is required for requesting the JWT - contents: read # This is required for actions/checkout - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: '0' - submodules: recursive + docker-push-containers-to-dockerhub-and-ecr: + runs-on: ubuntu-latest + permissions: + id-token: write # This is required for requesting the JWT + contents: read # This is required for actions/checkout + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: '0' + submodules: recursive - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 - env: - AWS_REGION: "us-east-1" - with: - role-to-assume: arn:aws:iam::${{ secrets.AWS_DOCKER_ACCOUNT_ID }}:role/github-actions-ecr-push - role-session-name: GitHub_to_AWS_via_FederatedOIDC - aws-region: ${{ env.AWS_REGION }} + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + env: + AWS_REGION: "us-east-1" + with: + role-to-assume: arn:aws:iam::${{ secrets.AWS_DOCKER_ACCOUNT_ID }}:role/github-actions-ecr-push + role-session-name: GitHub_to_AWS_via_FederatedOIDC + aws-region: ${{ env.AWS_REGION }} - - name: Login to Amazon ECR Public - id: login-ecr-public - uses: aws-actions/amazon-ecr-login@v2 - with: - registry-type: public + - name: Login to Amazon ECR Public + id: login-ecr-public + uses: aws-actions/amazon-ecr-login@v2 + with: + registry-type: public - - name: Docker build images - shell: bash - env: - ECR_REGISTRY_SERVER: ${{ steps.login-ecr-public.outputs.registry }} - run: | - docker buildx build \ - --push \ - --platform ${{ inputs.platforms }} \ - --tag ${{ inputs.docker-registry-server }}/${{ inputs.docker-image-repository }}:${{ inputs.image-tag }} \ - --tag ${{ inputs.docker-registry-server }}/${{ inputs.docker-image-repository }}:latest \ - --tag ${{ env.ECR_REGISTRY_SERVER }}/${{ inputs.ecr-image-repository }}:${{ inputs.image-tag }} \ - --tag ${{ env.ECR_REGISTRY_SERVER }}/${{ inputs.ecr-image-repository }}:latest \ - ${{ inputs.build-options }} \ - ${{ inputs.context }} + - name: Docker build images + shell: bash + env: + ECR_REGISTRY_SERVER: ${{ steps.login-ecr-public.outputs.registry }} + run: | + docker buildx build \ + --push \ + --platform ${{ inputs.platforms }} \ + --tag ${{ inputs.docker-registry-server }}/${{ inputs.docker-image-repository }}:${{ inputs.image-tag }} \ + --tag ${{ inputs.docker-registry-server }}/${{ inputs.docker-image-repository }}:latest \ + --tag ${{ env.ECR_REGISTRY_SERVER }}/${{ inputs.ecr-image-repository }}:${{ inputs.image-tag }} \ + --tag ${{ env.ECR_REGISTRY_SERVER }}/${{ inputs.ecr-image-repository }}:latest \ + ${{ inputs.build-options }} \ + ${{ inputs.context }} diff --git a/.github/workflows/gofmt.yaml b/.github/workflows/gofmt.yaml index bb1f0f5..c7516fe 100644 --- a/.github/workflows/gofmt.yaml +++ b/.github/workflows/gofmt.yaml @@ -1,5 +1,3 @@ ---- - name: 'gofmt' on: [workflow_call] diff --git a/.github/workflows/issue-automation.yaml b/.github/workflows/issue-automation.yaml index e5b5e95..8916d90 100644 --- a/.github/workflows/issue-automation.yaml +++ b/.github/workflows/issue-automation.yaml @@ -1,5 +1,3 @@ ---- - name: 'issue automation' on: @@ -11,7 +9,7 @@ on: jobs: add-issue-to-project: - uses: ${{ vars.SENZING_GITHUB_ACCOUNT_NAME }}/build-resources/.github/workflows/add-to-project.yaml@v1 + uses: senzing-factory/build-resources/.github/workflows/add-to-project.yaml@main with: project-number: ${{ vars.SENZING_PROJECT_FACTORY }} org: ${{ vars.SENZING_GITHUB_ACCOUNT_NAME }} @@ -20,7 +18,7 @@ jobs: SENZING_GITHUB_PROJECT_RW_TOKEN: ${{ secrets.SENZING_GITHUB_PROJECT_RW_TOKEN }} add-issue-labels: - uses: ${{ vars.SENZING_GITHUB_ACCOUNT_NAME }}/build-resources/.github/workflows/add-labels-to-issue.yaml@v1 + uses: senzing-factory/build-resources/.github/workflows/add-labels-to-issue.yaml@main secrets: ORG_MEMBERSHIP_TOKEN: ${{ secrets.ORG_MEMBERSHIP_TOKEN }} SENZING_MEMBERS: ${{ secrets.SENZING_MEMBERS }} diff --git a/.github/workflows/lint-repo.yaml b/.github/workflows/lint-repo.yaml new file mode 100644 index 0000000..c80ad2f --- /dev/null +++ b/.github/workflows/lint-repo.yaml @@ -0,0 +1,11 @@ +name: 'lint repo' + +on: + push: + branches-ignore: [main] + pull_request: + branches: [main] + +jobs: + lint-code-base: + uses: senzing-factory/build-resources/.github/workflows/linter.yaml@main diff --git a/.github/workflows/linter.yaml b/.github/workflows/linter.yaml index 473e204..c7326fa 100644 --- a/.github/workflows/linter.yaml +++ b/.github/workflows/linter.yaml @@ -1,12 +1,13 @@ ---- +name: 'linter' -name: linter - -on: - push: - branches-ignore: [main] - pull_request: - branches: [main] +on: + workflow_call: + inputs: + validate-all-codebase: + default: false + description: 'Lint all files or only modified: true/false' + required: false + type: boolean jobs: lint-code-base: @@ -27,7 +28,7 @@ jobs: - name: Lint Code Base uses: github/super-linter@v5 env: - # only lint new and modified files - VALIDATE_ALL_CODEBASE: false DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # only lint new and modified files + VALIDATE_ALL_CODEBASE: ${{ inputs.validate-all-codebase }} diff --git a/.github/workflows/make-go-github-file.yaml b/.github/workflows/make-go-github-file.yaml index ffceb75..cf215be 100644 --- a/.github/workflows/make-go-github-file.yaml +++ b/.github/workflows/make-go-github-file.yaml @@ -1,5 +1,3 @@ ---- - name: 'make go github file' on: diff --git a/.github/workflows/move-pr-to-done.yaml b/.github/workflows/move-pr-to-done.yaml index c2777be..7edb890 100644 --- a/.github/workflows/move-pr-to-done.yaml +++ b/.github/workflows/move-pr-to-done.yaml @@ -1,9 +1,12 @@ ---- - name: 'move pr to done' on: workflow_call: + inputs: + project: + default: "Garage" + required: false + type: string secrets: SENZING_GITHUB_PROJECT_RW_TOKEN: required: true @@ -17,6 +20,6 @@ jobs: if: ${{ github.event.pull_request.merged == true }} uses: alex-page/github-project-automation-plus@v0.9.0 with: - project: Community + project: ${{ inputs.project }} column: Done repo-token: ${{ secrets.SENZING_GITHUB_PROJECT_RW_TOKEN }} diff --git a/.github/workflows/pr-closed-automation.yaml b/.github/workflows/pr-closed-automation.yaml index c0bb712..67eccbd 100644 --- a/.github/workflows/pr-closed-automation.yaml +++ b/.github/workflows/pr-closed-automation.yaml @@ -1,5 +1,3 @@ ---- - name: 'pr closed automation' on: @@ -11,3 +9,5 @@ jobs: uses: senzing-factory/build-resources/.github/workflows/move-pr-to-done.yaml@main secrets: SENZING_GITHUB_PROJECT_RW_TOKEN: ${{ secrets.SENZING_GITHUB_PROJECT_RW_TOKEN }} + with: + project: "Factory" diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 0b11a2f..0000000 --- a/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,13 +0,0 @@ -# Pull request questions - -## Which issue does this address - -Issue number: #nnn - -## Why was change needed - -??? - -## What does change improve - -???