Skip to content

Commit

Permalink
checking .env file
Browse files Browse the repository at this point in the history
  • Loading branch information
yairsimantov20 committed Feb 20, 2024
1 parent 5fecbf3 commit 33137dd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
23 changes: 20 additions & 3 deletions sail/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ Runs the Ocean Sail command for a specific type of integration
| `port_client_secret` | <p>The port client secret</p> | `true` | `""` |
| `initialize_port_resources` | <p>Should ocean try to create the default blueprints, pages &amp; integration config for the integration</p> | `false` | `true` |
| `event_listener_type` | <p>The type of the event listener to use</p> | `false` | `ONCE` |
| `integration_config` | <p>Changing configuration between different integration types</p> | `false` | `{}` |
| `additional_env_vars` | <p>Additional environment variables to pass to the integration</p> | `false` | `{}` |
| `platform` | <p>The platform to run the integration on</p> | `false` | `linux/amd64` |
| `container_registry` | <p>The container registry to pull the image from</p> | `false` | `ghcr.io/port-labs` |
<!-- action-docs-inputs action="action.yml" -->

## Integration configuration

To each integration type its specific configuration please use `env:` to set the configuration as environment variables.
Each environment variable should be prefixed with `OCEAN__INTEGRATION__CONFIG__` and the name of the variable in uppercase.

<!-- action-docs-outputs action="action.yml" -->
## Outputs

Expand All @@ -37,4 +40,18 @@ Runs the Ocean Sail command for a specific type of integration
## Runs

This action is a `composite` action.
<!-- action-docs-runs action="action.yml" -->
<!-- action-docs-runs action="action.yml" -->

## Example usage

```yaml
- uses: ocean-github-action/sail@v1
with:
type: 'jira'
port_client_id: ${{ secrets.PORT_CLIENT_ID }}
port_client_secret: ${{ secrets.PORT_CLIENT_SECRET }}
config: |
jira_host: ${{ secrets.JIRA_HOST }}
atlassian_user_email: ${{ secrets.ATLASSIAN_USER_EMAIL }}
atlassian_user_token: ${{ secrets.ATLASSIAN_USER_TOKEN }}
```
13 changes: 11 additions & 2 deletions sail/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ inputs:
description: 'The type of the event listener to use'
required: false
default: 'ONCE'
config:
description: 'The configuration for the integration'
required: false

# Misc inputs
platform:
Expand Down Expand Up @@ -55,10 +58,16 @@ runs:
echo "OCEAN__PORT__CLIENT_ID=${{ inputs.port_client_id }}" >> .env
echo "OCEAN__PORT__CLIENT_SECRET=${{ inputs.port_client_secret }}" >> .env
if [[ "${{ inputs.config }}" ]]; then
inputs=$(echo ${{ inputs.config }} | yq eval -j -)
for key in $(echo $inputs | jq -r "keys[]"); do
value=$(echo $inputs | jq -r ".[$key]")
echo "OCEAN__INTEGRATION__CONFIG__${key}=${value}" >> .env
done
fi
env >> .env
cat .env
docker run -i --rm --platform=${{ inputs.platform }} --env-file .env $image_name
echo "exit_code=$?" >> $GITHUB_ENV
Expand Down

0 comments on commit 33137dd

Please sign in to comment.