-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into create-ocean-github-a…
…ction # Conflicts: # .github/workflows/test.yml # README.md # RELEASES.md # package.json
- Loading branch information
Showing
3 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!-- action-docs-header action="action.yml" --> | ||
|
||
<!-- action-docs-header action="action.yml" --> | ||
|
||
<!-- action-docs-description action="action.yml" --> | ||
## Description | ||
|
||
Runs the Ocean Sail command for a specific type of integration | ||
<!-- action-docs-description action="action.yml" --> | ||
|
||
The `sail` command is part of the Ocean framework and is used to run integrations. | ||
|
||
Read more about the Ocean framework [here](https://ocean.getport.io/) | ||
|
||
<!-- action-docs-inputs action="action.yml" --> | ||
## Inputs | ||
|
||
| name | description | required | default | | ||
| --- | --- | --- | --- | | ||
| `type` | <p>The type of the integration to run</p> | `true` | `""` | | ||
| `identifier` | <p>The identifier of the integration to run</p> | `false` | `""` | | ||
| `port_client_id` | <p>The Port client id</p> | `true` | `""` | | ||
| `port_client_secret` | <p>The Port client secret</p> | `true` | `""` | | ||
| `initialize_port_resources` | <p>Should ocean try to create the default blueprints, pages & integration config for the integration</p> | `false` | `true` | | ||
| `config` | <p>The configuration for the integration</p> | `false` | `""` | | ||
| `platform` | <p>The platform to run the integration on</p> | `false` | `linux/amd64` | | ||
| `image` | <p>The image to run the integration from</p> | `false` | `""` | | ||
| `version` | <p>The version of the integration to run</p> | `false` | `latest` | | ||
<!-- action-docs-inputs action="action.yml" --> | ||
|
||
<!-- action-docs-outputs action="action.yml" --> | ||
## Outputs | ||
|
||
| name | description | | ||
| --- | --- | | ||
| `exit_code` | <p>The exit code of the Ocean Sail command</p> | | ||
<!-- action-docs-outputs action="action.yml" --> | ||
|
||
## Available integration types | ||
|
||
All available integration types are listed in the [Ocean integrations library](https://ocean.getport.io/integrations-library/) and can also be found in the data sources menu in the Port UI. | ||
|
||
## 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 }} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: '🌊 Ocean Sail' | ||
description: 'Runs the Ocean Sail command for a specific type of integration' | ||
inputs: | ||
type: | ||
description: 'The type of the integration to run' | ||
required: true | ||
identifier: | ||
description: 'The identifier of the integration to run' | ||
required: false | ||
port_client_id: | ||
description: 'The Port client id' | ||
required: true | ||
port_client_secret: | ||
description: 'The Port client secret' | ||
required: true | ||
initialize_port_resources: | ||
description: 'Should Ocean try to create the default resources (blueprints, pages, integration config, etc.) provided with the integration' | ||
required: false | ||
default: 'true' | ||
config: | ||
description: 'The configuration for the integration' | ||
required: false | ||
|
||
# Misc inputs | ||
platform: | ||
description: 'The platform to run the integration on' | ||
required: false | ||
default: 'linux/amd64' | ||
image: | ||
description: 'The image to run the integration from' | ||
required: false | ||
version: | ||
description: 'The version of the integration to run' | ||
required: false | ||
default: 'latest' | ||
outputs: | ||
exit_code: | ||
description: 'The exit code of the Ocean Sail command' | ||
value: ${{ steps.ocean-sail.outputs.exit_code }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: ✅ Validate inputs | ||
shell: bash | ||
run: | | ||
[[ "${{ inputs.type }}" ]] || { echo "type input is empty" ; exit 1; } | ||
[[ "${{ inputs.port_client_id }}" ]] || { echo "inputs.port_client_id input is empty" ; exit 1; } | ||
[[ "${{ inputs.port_client_secret }}" ]] || { echo "inputs.port_client_secret input is empty" ; exit 1; } | ||
[[ "${{ inputs.initialize_port_resources }}" ]] || { echo "inputs.initialize_port_resources input is empty" ; exit 1; } | ||
[[ "${{ inputs.event_listener_type }}" ]] || { echo "inputs.event_listener_type input is empty" ; exit 1; } | ||
[[ "${{ inputs.platform }}" ]] || { echo "inputs.platform input is empty" ; exit 1; } | ||
[[ "${{ inputs.version }}" ]] || { echo "inputs.version input is empty" ; exit 1; } | ||
- name: 🌊 Run Ocean Sail dockerized | ||
shell: bash | ||
run: | | ||
image_name="ghcr.io/port-labs/port-ocean-${{ inputs.type }}:${{ inputs.version }}" | ||
if [[ "${{ inputs.image }}" ]]; then | ||
image_name="${{ inputs.image }}:${{ inputs.version }}" | ||
fi | ||
echo "OCEAN__PORT__CLIENT_ID=${{ inputs.port_client_id }}" >> .env | ||
echo "OCEAN__PORT__CLIENT_SECRET=${{ inputs.port_client_secret }}" >> .env | ||
echo "OCEAN__EVENT_LISTENER={\"type\":\"ONCE\"}" >> .env | ||
echo "OCEAN__INITIALIZE_PORT_RESOURCES=${{ inputs.initialize_port_resources }}" >> .env | ||
if [[ "${{ inputs.identifier }}" ]]; then | ||
echo "OCEAN__INTEGRATION__IDENTIFIER=${{ inputs.identifier }}" >> .env | ||
fi | ||
if [[ "${{ inputs.config }}" ]]; then | ||
for key in $(echo "${{ inputs.config }}" | yq eval "keys | .[]"); do | ||
value=$(echo "${{ inputs.config }}" | yq eval ".$key") | ||
upper_key=$(echo $key | tr '[:lower:]' '[:upper:]') | ||
echo "OCEAN__INTEGRATION__CONFIG__${upper_key}=${value}" >> .env | ||
done | ||
fi | ||
env >> .env | ||
docker run -i --rm --platform=${{ inputs.platform }} --env-file .env $image_name | ||
echo "exit_code=$?" >> $GITHUB_ENV | ||
- name: 🧹 Cleanup | ||
if: always() | ||
shell: bash | ||
run: rm .env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "ocean-github-action-sail", | ||
"version": "1.0.0", | ||
"repository": "[email protected]:port-labs/ocean-github-action.git", | ||
"author": "yair <[email protected]>", | ||
"scripts": { | ||
"ghadocs": "action-docs -u" | ||
} | ||
} |