Skip to content
check

GitHub Action

fluent-linter-action

v0.2.1 Latest version

fluent-linter-action

check

fluent-linter-action

Linter action for Fluentd and Fluent Bit configurations

Installation

Copy and paste the following snippet into your .yml file.

              

- name: fluent-linter-action

uses: chronosphereio/calyptia-fluent-linter-action@v0.2.1

Learn more about this action in chronosphereio/calyptia-fluent-linter-action

Choose a version

GitHub Marketplace unit-tests codecov Slack APACHE 2.0 license

Logo

Table of Contents 🦉

Getting started

Fluent Bit and Fluentd configurations are simple to use. Over time, the use of these configurations will grow and complexity with it. This action will help stay away from common pitfalls. It will add linting to your development process through workflows.

Installation

The following are steps to set up fluent linter action in your repository.

Add workflow to your repository

The first step is to create the workflow in your repository. We describe two ways: via Github UI or manually.

Manual

  1. Create the following directory in your repository .github/workflows/

  2. Under .github/workflows/ create a file called fluent-linter.yml

  3. Open .github/workflows/fluent-linter.yml

  4. paste the following content:

    on: pull_request
    
    name: Fluent-linter
    jobs:
      lint:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
          - id: fluent_linter_action
            uses: calyptia/fluent-linter-action@main
            with:
              calyptia-api-key: ${{ secrets.CALYPTIA_API_KEY }}
              follow-symbolic-links: 'true' # this is optional. It defaults to false.
              config-location-glob: '*.conf'
  5. Make sure to change config-location-glob to a glob that points to your Fluentd and Fluent Bit configuration within the repository. You can use this page to make sure your glob will match the necessary files.

If you want to see it in action, take a look at the example here

Using GitHub UI

  1. Go to the repository you wish to add the fluent-linter-action workflow.
  2. Under the tab Actions look for a button called New workflow.
  3. Under Choose workflow, you will find a text box. Please type "fluent-linter"
  4. You will find Fluent-linter-action by Calyptia. Look for a button called "Configure"
  5. Make sure to change config-location-glob to a glob that points to your fluentd and fluent-bit configuration within the repository.

If everything goes well, you will see an editor that will let you change anything on the workflow before committing. You can change the version from main to a specific one.

Make sure to commit the workflow to your repository.

For more information about using workflows, take a look at\ github documentation

If these instructions are not working for you, you can try the Manual approach

Get Calyptia API Key

In order to get the full linting capabilities from this action, you will need to get a Calyptia token. The token is easy to get. Head over to Calyptia Cloud and log in (you can use your GitHub account). On the left panel, find Account > settings > Generate API key. Give a recognizable name for safekeeping (you could name it linter). Please copy this token.

Configure secret in your repository

The last step will be to use the API Key we generated in Calyptia Cloud.

Add a new secret to your repository find Settings > Secrets > New repository secret. The name for this secret should be calyptia-api-key. Paste the secret you obtained in the step before.

note: Settings is often next to the insights tab. If you can't see the option, you are missing permissions.

Limitations

  • The current fluent-linter-action only works with Fluent Bit configurations. Fluentd configurations will be available shortly.
  • The current fluent-linter-action uses the latest master branch of Fluent Bit to run the checks. Please follow this issue for updates.
  • The current fluent-linter-action does not support ignoring or excluding any configuration from linting. Please follow this issue for updates. Be aware of this if using custom plugins or images/builds which may use invalid configuration options from the point of view of the main Fluent Bit version.

Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the Apache-2.0 License. See LICENSE for more information.