|
| 1 | +# N8n Source |
| 2 | + |
| 3 | +This is the repository for the N8n configuration based source connector. |
| 4 | +For information about how to use this connector within Airbyte, see [the documentation](https://docs.airbyte.io/integrations/sources/n8n). |
| 5 | + |
| 6 | +## Local development |
| 7 | + |
| 8 | +#### Building via Gradle |
| 9 | +You can also build the connector in Gradle. This is typically used in CI and not needed for your development workflow. |
| 10 | + |
| 11 | +To build using Gradle, from the Airbyte repository root, run: |
| 12 | +``` |
| 13 | +./gradlew :airbyte-integrations:connectors:source-n8n:build |
| 14 | +``` |
| 15 | + |
| 16 | +#### Create credentials |
| 17 | +**If you are a community contributor**, follow the instructions in the [documentation](https://docs.airbyte.io/integrations/sources/n8n) |
| 18 | +to generate the necessary credentials. Then create a file `secrets/config.json` conforming to the `source_n8n/spec.yaml` file. |
| 19 | +Note that any directory named `secrets` is gitignored across the entire Airbyte repo, so there is no danger of accidentally checking in sensitive information. |
| 20 | +See `integration_tests/sample_config.json` for a sample config file. |
| 21 | + |
| 22 | +**If you are an Airbyte core member**, copy the credentials in Lastpass under the secret name `source n8n test creds` |
| 23 | +and place them into `secrets/config.json`. |
| 24 | + |
| 25 | +### Locally running the connector docker image |
| 26 | + |
| 27 | +#### Build |
| 28 | +First, make sure you build the latest Docker image: |
| 29 | +``` |
| 30 | +docker build . -t airbyte/source-n8n:dev |
| 31 | +``` |
| 32 | + |
| 33 | +You can also build the connector image via Gradle: |
| 34 | +``` |
| 35 | +./gradlew :airbyte-integrations:connectors:source-n8n:airbyteDocker |
| 36 | +``` |
| 37 | +When building via Gradle, the docker image name and tag, respectively, are the values of the `io.airbyte.name` and `io.airbyte.version` `LABEL`s in |
| 38 | +the Dockerfile. |
| 39 | + |
| 40 | +#### Run |
| 41 | +Then run any of the connector commands as follows: |
| 42 | +``` |
| 43 | +docker run --rm airbyte/source-n8n:dev spec |
| 44 | +docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-n8n:dev check --config /secrets/config.json |
| 45 | +docker run --rm -v $(pwd)/secrets:/secrets airbyte/source-n8n:dev discover --config /secrets/config.json |
| 46 | +docker run --rm -v $(pwd)/secrets:/secrets -v $(pwd)/integration_tests:/integration_tests airbyte/source-n8n:dev read --config /secrets/config.json --catalog /integration_tests/configured_catalog.json |
| 47 | +``` |
| 48 | +## Testing |
| 49 | + |
| 50 | +#### Acceptance Tests |
| 51 | +Customize `acceptance-test-config.yml` file to configure tests. See [Source Acceptance Tests](https://docs.airbyte.io/connector-development/testing-connectors/source-acceptance-tests-reference) for more information. |
| 52 | +If your connector requires to create or destroy resources for use during acceptance tests create fixtures for it and place them inside integration_tests/acceptance.py. |
| 53 | + |
| 54 | +To run your integration tests with docker |
| 55 | + |
| 56 | +### Using gradle to run tests |
| 57 | +All commands should be run from airbyte project root. |
| 58 | +To run unit tests: |
| 59 | +``` |
| 60 | +./gradlew :airbyte-integrations:connectors:source-n8n:unitTest |
| 61 | +``` |
| 62 | +To run acceptance and custom integration tests: |
| 63 | +``` |
| 64 | +./gradlew :airbyte-integrations:connectors:source-n8n:integrationTest |
| 65 | +``` |
| 66 | + |
| 67 | +## Dependency Management |
| 68 | +All of your dependencies should go in `setup.py`, NOT `requirements.txt`. The requirements file is only used to connect internal Airbyte dependencies in the monorepo for local development. |
| 69 | +We split dependencies between two groups, dependencies that are: |
| 70 | +* required for your connector to work need to go to `MAIN_REQUIREMENTS` list. |
| 71 | +* required for the testing need to go to `TEST_REQUIREMENTS` list |
| 72 | + |
| 73 | +### Publishing a new version of the connector |
| 74 | +You've checked out the repo, implemented a million dollar feature, and you're ready to share your changes with the world. Now what? |
| 75 | +1. Make sure your changes are passing unit and integration tests. |
| 76 | +1. Bump the connector version in `Dockerfile` -- just increment the value of the `LABEL io.airbyte.version` appropriately (we use [SemVer](https://semver.org/)). |
| 77 | +1. Create a Pull Request. |
| 78 | +1. Pat yourself on the back for being an awesome contributor. |
| 79 | +1. Someone from Airbyte will take a look at your PR and iterate with you to merge it into master. |
0 commit comments