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

Showcase support for file paths in project-spec.yaml #533

Merged
merged 4 commits into from
Aug 16, 2024
Merged
Changes from 2 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
24 changes: 19 additions & 5 deletions docs/deploy/portability.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Lightning.

### The project "spec"

The project specification (or "spec") is often saved as a `project.yaml` file.
The project specification (or "spec") is often saved as a `project.yaml` file. The spec now supports 2 ways of defining job bodies: inline, or as an object referencing an external file.

```yaml
name: openhie-project
Expand Down Expand Up @@ -68,17 +68,17 @@ workflows:
enabled: true
# credential:
# globals:
body: |
fn(state => state);
body:
path: ./job-bodies/notify-success.js

Notify-CHW-upload-failed:
name: Notify-CHW-upload-failed
adaptor: '@openfn/language-http@latest'
enabled: true
# credential:
# globals:
body: |
fn(state => state);
body:
path: ./job-bodies/notify-failure.j

triggers:
webhook:
Expand All @@ -102,6 +102,20 @@ workflows:
condition: on_job_failure
```

In this spec, you can see the two different ways to define a job's body:

1. Inline body:
Used in the `FHIR-standard-Data-with-change` and `Send-to-OpenHIM-to-route-to-SHR` jobs. The body is directly written in the YAML file.

2. External file reference:
Used in both `Notify-CHW-upload-successful` and `Notify-CHW-upload-failed` jobs. The body is stored in separate files, referenced by the path key. This allows for better organization of complex job logic.

When using file paths:

- Paths are relative to the location of the `project.yaml` file.
- Ensure that the referenced files exist and contain valid job body code.
- This method is particularly useful for complex jobs or when you want to reuse job bodies across different projects.

### The project "state"

The project state is a representation of a particular project as _on a specific
Expand Down