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

pre-commit: setup prettier to autoformat relevant YAML files #807

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 80 additions & 81 deletions .github/ISSUE_TEMPLATE/1_new-issue.yml
Original file line number Diff line number Diff line change
@@ -1,84 +1,83 @@
name: 💡 General Issue
description: A general template for many kinds of issues.
body:

- type: textarea
id: description
attributes:
label: Description
description: |
Describe what you are proposing, or the question you're asking. Provide as much context as possible and link to related issues and/or pull requests.
This section should contain "what" you are proposing.
🐛 If this issue is related to a bug, include information about how to reproduce it and add the `bug` label.
✨ If this issue is an enhancement or feature, add the `enhancement` label.
✅ If this issue is a task to complete, add the `task` label.
validations:
required: true

- type: textarea
id: value
attributes:
label: Value / benefit
description: |
What is the value in resolving this issue, and who will benefit from it? Include any information that could help us prioritize the issue.
This section should contain "why" this issue should be resolved.
✨ If this is for a new feature or enhancement, consider adding [user stories](https://www.atlassian.com/agile/project-management/user-stories).
🐛 If this is for a bug or problem, estimate the severity and scale of the impact.
placeholder: |
- Many people have requested this feature, as seen in...
- This would facilitate XXX which is common for our hub users
- This problem affects anybody that does XXX on a hub
validations:
required: true

- type: textarea
id: implementation
attributes:
label: Implementation details
description: |
Anything that will help others understand how this issue could be addressed. Where appropriate, note locations in a codebase where a change would need to be made, or other considerations that should be taken.
This section should contain "how" this issue should be resolved.
_If you can't think of anything then just leave this blank and we can fill it in later! This can be filled in as we understand more about an issue._
placeholder: |
- This change would be probably need to be over here...
- The best way to do this would be...
- There are a few ways to do this, we should choose between...
validations:
required: false

- type: textarea
id: tasks
attributes:
label: Tasks to complete
description: |
Any concrete tasks that should be completed to resolve this issue.
The more specific the better. If issues have lots of complex tasks associated with them, consider breaking them up into separate issues with cross-links.
_If you can't think of anything then just leave this blank and we can fill it in later! This can be filled in as we understand more about an issue._
placeholder: |
- [ ] Discuss and decide on what to do...
- [ ] Implement partial feature A...
validations:
required: false

- type: textarea
id: updates
attributes:
label: Updates
description: |
To avoid that others have to read through the full thread of comments, please update the initial issue with important updates (e.g. decisions taken) regularly. You can update any of the sections above directly (this is encouraged!) or add new information below in this new section.
_If you can't think of anything then just leave this blank and we can fill it in later! This can be filled in as we understand more about an issue._
validations:
required: false
- type: textarea
id: description
attributes:
label: Description
description: |
Describe what you are proposing, or the question you're asking. Provide as much context as possible and link to related issues and/or pull requests.
This section should contain "what" you are proposing.
🐛 If this issue is related to a bug, include information about how to reproduce it and add the `bug` label.
✨ If this issue is an enhancement or feature, add the `enhancement` label.
✅ If this issue is a task to complete, add the `task` label.
validations:
required: true

- type: textarea
id: value
attributes:
label: Value / benefit
description: |
What is the value in resolving this issue, and who will benefit from it? Include any information that could help us prioritize the issue.
This section should contain "why" this issue should be resolved.
✨ If this is for a new feature or enhancement, consider adding [user stories](https://www.atlassian.com/agile/project-management/user-stories).
🐛 If this is for a bug or problem, estimate the severity and scale of the impact.
placeholder: |
- Many people have requested this feature, as seen in...
- This would facilitate XXX which is common for our hub users
- This problem affects anybody that does XXX on a hub
validations:
required: true

- type: textarea
id: implementation
attributes:
label: Implementation details
description: |
Anything that will help others understand how this issue could be addressed. Where appropriate, note locations in a codebase where a change would need to be made, or other considerations that should be taken.
This section should contain "how" this issue should be resolved.
_If you can't think of anything then just leave this blank and we can fill it in later! This can be filled in as we understand more about an issue._
placeholder: |
- This change would be probably need to be over here...
- The best way to do this would be...
- There are a few ways to do this, we should choose between...
validations:
required: false

- type: textarea
id: tasks
attributes:
label: Tasks to complete
description: |
Any concrete tasks that should be completed to resolve this issue.
The more specific the better. If issues have lots of complex tasks associated with them, consider breaking them up into separate issues with cross-links.
_If you can't think of anything then just leave this blank and we can fill it in later! This can be filled in as we understand more about an issue._
placeholder: |
- [ ] Discuss and decide on what to do...
- [ ] Implement partial feature A...
validations:
required: false

- type: textarea
id: updates
attributes:
label: Updates
description: |
To avoid that others have to read through the full thread of comments, please update the initial issue with important updates (e.g. decisions taken) regularly. You can update any of the sections above directly (this is encouraged!) or add new information below in this new section.
_If you can't think of anything then just leave this blank and we can fill it in later! This can be filled in as we understand more about an issue._
validations:
required: false
16 changes: 8 additions & 8 deletions .github/ISSUE_TEMPLATE/2_new-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ body:
attributes:
value: |
# Ask for a new 2i2c JupyterHub!
This template is designed to help you provide information about your 2i2c Hub so that a 2i2c Engineer can set it up properly. Answer the sections below as best you can. We can update information as we learn more.
# Community Information
Expand Down Expand Up @@ -58,7 +58,7 @@ body:
attributes:
label: Target start date
description: |
The target start date when this hub will begin operation. This should be at least a week before any important usage of the hub will occur, to ensure that the Hub Representative has time to try it out.
The target start date when this hub will begin operation. This should be at least a week before any important usage of the hub will occur, to ensure that the Hub Representative has time to try it out.
validations:
required: true

Expand Down Expand Up @@ -125,7 +125,7 @@ body:
attributes:
label: Hub logo URL
description: |
A URL that the hub's logo will point to when users click on it on the landing page (optional)
A URL that the hub's logo will point to when users click on it on the landing page (optional)
validations:
required: false

Expand All @@ -134,7 +134,7 @@ body:
attributes:
label: Hub image service
description: |
The image registry service used for this hub's user image, if a custom user image is desired. For example, a [quay.io registry image](https://quay.io/). See [the Infrastructure documentation on custom images](https://infrastructure.2i2c.org/en/latest/howto/customize/custom-image.html) for more information.
The image registry service used for this hub's user image, if a custom user image is desired. For example, a [quay.io registry image](https://quay.io/). See [the Infrastructure documentation on custom images](https://infrastructure.2i2c.org/en/latest/howto/customize/custom-image.html) for more information.
validations:
required: false

Expand Down Expand Up @@ -185,7 +185,7 @@ body:
description: |
The unique ID used to identify this hub. Should be URL-friendly and short. (e.g. `my-university`).
validations:
required: false
required: false

- type: input
id: hub-cluster
Expand All @@ -194,7 +194,7 @@ body:
description: |
The cloud cluster where this hub will be run. For example, `pilot` or `cloudbank`.
validations:
required: false
required: false

- type: input
id: hub-url
Expand All @@ -203,7 +203,7 @@ body:
description: |
The URL of the hub, should be `<hub ID>.<hub cluster>.2i2c.cloud`.
validations:
required: false
required: false

- type: input
id: hub-template
Expand All @@ -215,7 +215,7 @@ body:
1. `basehub`: a basic JupyterHub with a fairly standard setup.
2. `daskhub`: a JupyterHub with a Dask Gateway enabled for scalable computing.
validations:
required: false
required: false

- type: checkboxes
id: tasks-to-deploy
Expand Down
8 changes: 4 additions & 4 deletions .github/actions/deploy/action.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: 'Deploy prerequisites'
description: 'Prerequisites needed to deploy hubs in a 2i2c cluster'
name: "Deploy prerequisites"
description: "Prerequisites needed to deploy hubs in a 2i2c cluster"
inputs:
cluster:
description: 'Cluster name'
description: "Cluster name"
required: true
default: '2i2c'
default: "2i2c"
runs:
using: "composite"
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-grafana-dashboards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@master
with:
version: '290.0.1'
version: "290.0.1"
# This is used for KMS only
project_id: two-eye-two-see
service_account_key: ${{ secrets.GCP_KMS_DECRYPTOR_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-hubs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
(steps.config_files.outputs.hub_config == 'true')
uses: google-github-actions/setup-gcloud@master
with:
version: '290.0.1'
version: "290.0.1"
# This is used for KMS only
project_id: two-eye-two-see
service_account_key: ${{ secrets.GCP_KMS_DECRYPTOR_KEY }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doc-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
run: |
cd docs
conda activate infrastructure-docs
make linkcheck SPHINXOPTS='--color -W --keep-going'
make linkcheck SPHINXOPTS='--color -W --keep-going'
2 changes: 1 addition & 1 deletion .github/workflows/python-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
run: pip install flake8
- name: Run flake8
run: |
flake8 deployer/ docs/
flake8 deployer/ docs/
4 changes: 2 additions & 2 deletions .github/workflows/terraform-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Lint terraform
on:
pull_request:
paths:
- terraform/*
- terraform/*

jobs:
lint:
Expand All @@ -15,4 +15,4 @@ jobs:
- name: Run terraform linter
run: tflint terraform
- name: Check terraform formatting
run: terraform fmt -check -diff terraform/
run: terraform fmt -check -diff terraform/
20 changes: 0 additions & 20 deletions .github/workflows/yaml-lint.yaml

This file was deleted.

19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# pre-commit is a tool to perform a predefined set of tasks manually and/or
# automatically before git commits are made.
#
# Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level
#
# Common tasks
#
# - Run on all files: pre-commit run --all-files
# - Register git hooks: pre-commit install --install-hooks
#
repos:
# FIXME: Consider adding more, for example by looking at those configured for
# TLJH in https://github.com/jupyterhub/the-littlest-jupyterhub/blob/main/.pre-commit-config.yaml

# Autoformat: markdown, yaml
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.4.1
hooks:
- id: prettier
15 changes: 15 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Helm chart's templates aren't pure YAML files
**/templates/

# It would be trouble if we had two automatic formatters on the same files. This
# could happen if we would auto-format the sops generated files with prettier.
secrets/**/*
**/secrets.yaml
!secrets/config/hubs/schema.yaml

# To create a minimal change suggestion, prettier was introduced to auto-format
# the YAML files only. It is absolutely reasonable to auto-format markdown files
# and json files as well, but for now, let's make prettier only auto-format
# YAML.
**/*.md
**/*.json
8 changes: 4 additions & 4 deletions config/hubs/2i2c.cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 2i2c
image_repo: "us-central1-docker.pkg.dev/two-eye-two-see/pilot-hubs-registry/base-user"
image_repo: "us-central1-docker.pkg.dev/two-eye-two-see/pilot-hubs-registry/base-user"
provider: gcp
gcp:
key: secrets/2i2c.json
Expand Down Expand Up @@ -417,7 +417,7 @@ hubs:
config:
Authenticator:
allowed_users: &aup_users
- <staff_github_ids>
- swalker
- shaolintl
- <staff_github_ids>
- swalker
- shaolintl
admin_users: *aup_users
Loading