Skip to content

Commit

Permalink
Add markdownlint and fix issues (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome authored Aug 3, 2023
1 parent e8f03c8 commit b3b403b
Show file tree
Hide file tree
Showing 13 changed files with 324 additions and 175 deletions.
12 changes: 7 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ A clear and concise description of what the bug is.

Provide the following files as part of the bug report

* NGINX Plus configuration. Run `sudo nginx -T` to gather the full configuration
* nginx-asg-sync configuration from `/etc/nginx/config.yaml`
- NGINX Plus configuration. Run `sudo nginx -T` to gather the full configuration
- nginx-asg-sync configuration from `/etc/nginx/config.yaml`

Steps to reproduce the behavior, such as:

1. Scale from 2 to 5 EC2 instances
2. New instances not added to nginx.conf
3. See error in `/var/log/nginx-asg-sync/nginx-asg-sync.log`
Expand All @@ -23,9 +24,10 @@ Steps to reproduce the behavior, such as:
A clear and concise description of what you expected to happen.

**Your environment**
* Version of nginx-asg-sync
* Version of NGINX Plus
* Version of the OS

- Version of nginx-asg-sync
- Version of NGINX Plus
- Version of the OS

**Additional context**
Add any other context about the problem here. Any log files you want to share.
5 changes: 4 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
### Proposed changes
Describe the use case and detail of the change. If this PR addresses an issue on GitHub, make sure to include a link to that issue here in this description (not in the title of the PR).

Describe the use case and detail of the change. If this PR addresses an issue on GitHub, make sure to include a link to
that issue here in this description (not in the title of the PR).

### Checklist

Before creating a PR, run through this checklist and mark each as complete.

- [ ] I have read the [CONTRIBUTING](https://github.com/nginxinc/nginx-asg-sync/blob/main/CONTRIBUTING.md) doc
Expand Down
18 changes: 18 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Rule configuration.
# For rule descriptions and how to fix: https://github.com/DavidAnson/markdownlint/tree/main#rules--aliases
config:
ul-style:
style: dash
no-duplicate-heading:
siblings_only: true
line-length:
line_length: 120
code_blocks: false
tables: false

# Define glob expressions to ignore
ignores:
- ".github/"

# Fix any fixable errors
fix: true
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ repos:
- id: requirements-txt-fixer
- id: fix-byte-order-marker
- id: detect-private-key

- repo: local
hooks:
- id: golang-diff
Expand All @@ -33,23 +34,32 @@ repos:
language: system
types: [go]
pass_filenames: false

- repo: https://github.com/golangci/golangci-lint
rev: v1.53.3
hooks:
- id: golangci-lint
args: [--new-from-patch=/tmp/diff.patch]

- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
hooks:
- id: pyupgrade

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black

- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.8.1
hooks:
- id: markdownlint-cli2

ci:
skip: [golang-diff, golangci-lint]
42 changes: 25 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
# Changelog

## 0.5.0 (February 24, 2021)

IMPROVEMENTS:

* Add InService option for AWS [#39](https://github.com/nginxinc/nginx-asg-sync/pull/39)
* Update log format [#42](https://github.com/nginxinc/nginx-asg-sync/pull/42)
- Add InService option for AWS [#39](https://github.com/nginxinc/nginx-asg-sync/pull/39)
- Update log format [#42](https://github.com/nginxinc/nginx-asg-sync/pull/42)

## 0.4-1 (November 22, 2019)

IMPROVEMENTS:

* Add support to set upstream server parameters: `max_conns`, `max_fails`, `fail_timeout` and `slow_start` in the configuration file. https://github.com/nginxinc/nginx-asg-sync/pull/33
* Add support to use wildcards in the names of AWS Auto Scaling groups. https://github.com/nginxinc/nginx-asg-sync/pull/29/
* Allow nginx-asg-sync to detect the region where it is running (use `region: self` in the configuration file). https://github.com/nginxinc/nginx-asg-sync/pull/27
- Add support to set upstream server parameters: `max_conns`, `max_fails`, `fail_timeout` and `slow_start` in the
configuration file. <https://github.com/nginxinc/nginx-asg-sync/pull/33>
- Add support to use wildcards in the names of AWS Auto Scaling groups.
<https://github.com/nginxinc/nginx-asg-sync/pull/29/>
- Allow nginx-asg-sync to detect the region where it is running (use `region: self` in the configuration file).
<https://github.com/nginxinc/nginx-asg-sync/pull/27>

## 0.3-1 (September 4, 2019)

IMPROVEMENTS:

* Add support for Azure Virtual Machine Scale Sets https://github.com/nginxinc/nginx-asg-sync/pull/24
* Create separate documentation for the configuration for different cloud providers: [aws](examples/aws.md) and [azure](examples/azure.md).
* Ubuntu 14.04 (Trusty) is no longer supported.
- Add support for Azure Virtual Machine Scale Sets <https://github.com/nginxinc/nginx-asg-sync/pull/24>
- Create separate documentation for the configuration for different cloud providers: [aws](examples/aws.md) and
[azure](examples/azure.md).
- Ubuntu 14.04 (Trusty) is no longer supported.

UPGRADE:

Expand All @@ -35,20 +41,23 @@ Note: the supported versions of NGINX Plus are R18 and higher.

IMPROVEMENTS:

* Add supporting documentation for the project https://github.com/nginxinc/nginx-asg-sync/pull/10
* Update package layout https://github.com/nginxinc/nginx-asg-sync/pull/9
* Use new NGINX Plus API https://github.com/nginxinc/nginx-asg-sync/pull/7
- Add supporting documentation for the project <https://github.com/nginxinc/nginx-asg-sync/pull/10>
- Update package layout <https://github.com/nginxinc/nginx-asg-sync/pull/9>
- Use new NGINX Plus API <https://github.com/nginxinc/nginx-asg-sync/pull/7>

UPGRADE:

The upgrade process requires changing both NGINX Plus configuration and nginx-asg-sync configuration. Below are the recommended steps to follow:
The upgrade process requires changing both NGINX Plus configuration and nginx-asg-sync configuration. Below are the
recommended steps to follow:

1. Upgrade NGINX Plus to R14 or R15
2. Enable the new API in the NGINX Plus configuration while keeping the upstream_conf and the status API enabled. See an example of configuring the new API in the configuration section, but make sure to keep the upstream_conf and the status API.
2. Enable the new API in the NGINX Plus configuration while keeping the upstream_conf and the status API enabled. See an
example of configuring the new API in the configuration section, but make sure to keep the upstream_conf and the
status API.
3. Reload NGINX Plus to apply the updated configuration
4. Modify the /etc/nginx/aws.yaml file:
* Remove the `upstream_conf_endpoint` and `status_endpoint` fields.
* Add the `api_endpoint` field. See an example in the configuration section of the README.md
- Remove the `upstream_conf_endpoint` and `status_endpoint` fields.
- Add the `api_endpoint` field. See an example in the configuration section of the README.md
5. Download the Release 0.2 nginx-asg-sync package for your OS and upgrade the package using the OS tools (dpkg or rpm).
6. Check the logs of nginx-asg-sync to make sure that it is working properly after the upgrade.
7. Finally remove the upstream_conf and the status API from NGINX Plus configuration.
Expand All @@ -60,8 +69,7 @@ Note: the supported versions of NGINX Plus are R14 and higher.

IMPROVEMENTS:

* Make sure nginx-asg-sync works with NGINX Plus R13

- Make sure nginx-asg-sync works with NGINX Plus R13

## 0.1-1 (March 6, 2017)

Expand Down
24 changes: 12 additions & 12 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities
Expand All @@ -57,7 +57,7 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
reported by contacting the project team at <[email protected]>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Expand All @@ -70,6 +70,6 @@ members of the project's leadership.
## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
available at <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>

[homepage]: https://www.contributor-covenant.org
65 changes: 38 additions & 27 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Contributing Guidelines

The following is a set of guidelines for contributing to the NGINX AWS Auto-Scale Group Sync tool. We really appreciate that you are considering contributing!
The following is a set of guidelines for contributing to the NGINX AWS Auto-Scale Group Sync tool. We really appreciate
that you are considering contributing!

#### Table Of Contents
## Table Of Contents

[Ask a Question](#ask-a-question)

Expand All @@ -11,8 +12,9 @@ The following is a set of guidelines for contributing to the NGINX AWS Auto-Scal
[Contributing](#contributing)

[Style Guides](#style-guides)
* [Git Style Guide](#git-style-guide)
* [Go Style Guide](#go-style-guide)

- [Git Style Guide](#git-style-guide)
- [Go Style Guide](#go-style-guide)

[Code of Conduct](CODE_OF_CONDUCT.md)

Expand All @@ -24,57 +26,66 @@ You can also join our [Community Slack](https://community.nginx.org/joinslack) w

Please reserve GitHub issues for feature requests and bugs rather than general questions.


## Getting Started

Read the installation, configuration and building steps in the [README](README.md).

### Project Structure

* nginx-asg-sync is a service written in Go that works with NGINX Plus.
* The main code is found under `/cmd/sync/`
* Tools for building the service for supported Operating Systems are found under `/build/package`
* We use [Go modules](https://github.com/golang/go/wiki/Modules) for managing dependencies.
* There is a Makefile at the project root used in the build steps.
- nginx-asg-sync is a service written in Go that works with NGINX Plus.
- The main code is found under `/cmd/sync/`
- Tools for building the service for supported Operating Systems are found under `/build/package`
- We use [Go modules](https://github.com/golang/go/wiki/Modules) for managing dependencies.
- There is a Makefile at the project root used in the build steps.

## Contributing

### Report a Bug

To report a bug, open an issue on GitHub with the label `bug` using the available bug report issue template. Please ensure the issue has not already been reported.
To report a bug, open an issue on GitHub with the label `bug` using the available bug report issue template. Please
ensure the issue has not already been reported.

### Suggest an Enhancement

To suggest an enhancement, please create an issue on GitHub with the label `enhancement` using the available feature issue template.
To suggest an enhancement, please create an issue on GitHub with the label `enhancement` using the available feature
issue template.

### Open a Pull Request

* Fork the repo, create a branch, submit a PR when your changes are tested and ready for review
* Fill in [our pull request template](.github/PULL_REQUEST_TEMPLATE.md)
- Fork the repo, create a branch, submit a PR when your changes are tested and ready for review
- Fill in [our pull request template](.github/PULL_REQUEST_TEMPLATE.md)

> **Note**
>
> If you’d like to implement a new feature, please consider creating a feature request issue first to start a discussion about the feature.
> If you’d like to implement a new feature, please consider creating a feature request issue first to start a discussion
> about the feature.
### Issue lifecycle

* When an issue or PR is created, it will be triaged by the core development team and assigned a label to indicate the type of issue it is (bug, feature request, etc) and to determine the milestone. Please see the [Issue Lifecycle](ISSUE_LIFECYCLE.md) document for more information.
- When an issue or PR is created, it will be triaged by the core development team and assigned a label to indicate the
type of issue it is (bug, feature request, etc) and to determine the milestone. Please see the [Issue
Lifecycle](ISSUE_LIFECYCLE.md) document for more information.

## Style Guides

### Git Style Guide

* Keep a clean, concise and meaningful git commit history on your branch, rebasing locally and squashing before submitting a PR
* Follow the guidelines of writing a good commit message as described here https://chris.beams.io/posts/git-commit/ and summarized in the next few points
* In the subject line, use the present tense ("Add feature" not "Added feature")
* In the subject line, use the imperative mood ("Move cursor to..." not "Moves cursor to...")
* Limit the subject line to 72 characters or less
* Reference issues and pull requests liberally after the subject line
* Add more detailed description in the body of the git message (`git commit -a` to give you more space and time in your text editor to write a good message instead of `git commit -am`)
- Keep a clean, concise and meaningful git commit history on your branch, rebasing locally and squashing before
submitting a PR
- Follow the guidelines of writing a good commit message as described here <https://chris.beams.io/posts/git-commit/>
and summarized in the next few points
- In the subject line, use the present tense ("Add feature" not "Added feature")
- In the subject line, use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the subject line to 72 characters or less
- Reference issues and pull requests liberally after the subject line
- Add more detailed description in the body of the git message (`git commit -a` to give you more space and time in
your text editor to write a good message instead of `git commit -am`)

### Go Style Guide

* Run `gofmt` over your code to automatically resolve a lot of style issues. Most editors support this running automatically when saving a code file.
* Run `go lint` and `go vet` on your code too to catch any other issues.
* Follow this guide on some good practice and idioms for Go - https://github.com/golang/go/wiki/CodeReviewComments
* To check for extra issues, install [golangci-lint](https://github.com/golangci/golangci-lint) and run `make lint` or `golangci-lint run`
- Run `gofmt` over your code to automatically resolve a lot of style issues. Most editors support this running
automatically when saving a code file.
- Run `go lint` and `go vet` on your code too to catch any other issues.
- Follow this guide on some good practice and idioms for Go - <https://github.com/golang/go/wiki/CodeReviewComments>
- To check for extra issues, install [golangci-lint](https://github.com/golangci/golangci-lint) and run `make lint` or
`golangci-lint run`
Loading

0 comments on commit b3b403b

Please sign in to comment.