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

Running local lint checks prior to raising PR #523

Open
prathapreddy123 opened this issue Jul 25, 2020 · 1 comment
Open

Running local lint checks prior to raising PR #523

prathapreddy123 opened this issue Jul 25, 2020 · 1 comment
Assignees

Comments

@prathapreddy123
Copy link
Member

prathapreddy123 commented Jul 25, 2020

Issue

Today when user submits a pull request to professional services repo, lint checks are executed via cloud build trigger inside google cloud project owned by repo maintainers. In case of failures, PR authors do not have visibility for the failure reasons.

To resolve this we have recommendation in Contribution section to run local lint checks. But this process has multiple steps and dependencies on terraform and docker to be available.

Proposal

Build a linitchecker.yaml that PR author can run locally using single gcloud command without need for terraform and docker

#linitchecker.yaml

steps:
  # Step 0: Pull image if exists
  - name: gcr.io/cloud-builders/docker
    entrypoint: 'bash'
    args: ['-c', 'docker pull gcr.io/$PROJECT_ID/${_IMAGE_NAME}:${_IMAGE_VERSION} || exit 0']

  # Step 1: Create docker image with required tools
  - name: gcr.io/cloud-builders/docker
    args:
      - 'build'
      - '--tag=gcr.io/$PROJECT_ID/${_IMAGE_NAME}:${_IMAGE_VERSION}'
      - '--cache-from=gcr.io/$PROJECT_ID/${_IMAGE_NAME}:${_IMAGE_VERSION}'
      - '--file=cloudbuild/Dockerfile'
      - '.'
  # Step 2: Run lint check
  - name: gcr.io/$PROJECT_ID/${_IMAGE_NAME}
    args: ["test"]

substitutions:
  # Default values
  _IMAGE_NAME: 'professionalservices-lintcheck'
  _IMAGE_VERSION: 'latest'

timeout: 900s
images: ['gcr.io/$PROJECT_ID/${_IMAGE_NAME}:${_IMAGE_VERSION}']

Run the gcloud command: gcloud builds submit --config lintchecker.yaml .

If we are planning to move forward with dynamic cloud build, rebase checks can also be included so that author has complete visibility on all the checks before PR submission

@tswast
Copy link
Contributor

tswast commented Jul 27, 2020

If we make the linter docker image public, we can remove the need for the terraform step. (I think someone may have already done this)

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

No branches or pull requests

3 participants