diff --git a/README.md b/README.md index b59980b..259ff86 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ _Decodable provides a managed PyFlink service. Learn more [here](https://docs.de | Example | Description | |-------------------------------------------------------|-------------| +| [Decodable CI/CD](declarative-cicd) | An example of using Decodable with GitHub Actions| | [Decodable CLI Docker image](cli-docker) | An example Dockerfile for running the Decodable CLI under Docker.| ## License diff --git a/declarative-cicd/README.adoc b/declarative-cicd/README.adoc new file mode 100644 index 0000000..65bd7c0 --- /dev/null +++ b/declarative-cicd/README.adoc @@ -0,0 +1,5 @@ += Using Decodable with GitHub Actions + +The folder shows an example of how you can integrate Decodable with your CICD workflow using GitHub Actions. + +Refer to https://docs.decodable.co/cli/integrate-with-github-actions.html[the documentation page] for details. \ No newline at end of file diff --git a/declarative-cicd/connections/datagen-01.yaml b/declarative-cicd/connections/datagen-01.yaml new file mode 100644 index 0000000..79af534 --- /dev/null +++ b/declarative-cicd/connections/datagen-01.yaml @@ -0,0 +1,25 @@ +--- +kind: connection +metadata: + name: datagen-01 + description: "" +spec_version: v2 +spec: + connector: datagen + type: source + stream_name: envoy + schema_v2: + fields: + - kind: physical + name: message + type: STRING + constraints: {} + properties: + delay: "5000" + format: json + data.type: envoy + execution: + active: true + task_count: 1 + task_size: M + diff --git a/declarative-cicd/example-workflow.yaml b/declarative-cicd/example-workflow.yaml new file mode 100644 index 0000000..484b92e --- /dev/null +++ b/declarative-cicd/example-workflow.yaml @@ -0,0 +1,48 @@ +name: Deploy Decodable resources + +on: + push: + branches: + - main + # pull_request: + workflow_dispatch: + +jobs: + setup-and-apply: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Download and unpack the Decodable CLI + run: | + curl -L https://releases.decodable.co/decodable-cli/linux/amd64/decodable-cli-linux-amd64-1.20.0.tar.gz -o /tmp/decodable-cli.tar.gz && \ + tar -xzf /tmp/decodable-cli.tar.gz -C /tmp && \ + sudo mv /tmp/decodable-cli-linux-amd64-1.20.0/bin/decodable /usr/local/bin && \ + rm -r /tmp/decodable-cli.tar.gz /tmp/decodable-cli-linux-amd64-1.20.0 + + - name: Create Decodable CLI auth file + run: | + mkdir -p ~/.decodable + cat < ~/.decodable/auth + version: 1.0.0 + tokens: + default: + refresh_token: ${{ secrets.DECODABLE_REFRESH_TOKEN }} + EOF + + - name: Create Decodable CLI config file + run: | + mkdir -p ~/.decodable + cat < ~/.decodable/config + version: 1.0.0 + active-profile: default + + profiles: + default: + account: ${{ vars.DECODABLE_ACCOUNT_NAME }} + EOF + + - name: Apply all Decodable resources + run: decodable apply $(find declarative-cicd -name '*.yaml') diff --git a/declarative-cicd/pipelines/count-messages.yaml b/declarative-cicd/pipelines/count-messages.yaml new file mode 100644 index 0000000..58b7c18 --- /dev/null +++ b/declarative-cicd/pipelines/count-messages.yaml @@ -0,0 +1,13 @@ +--- +kind: pipeline +metadata: + name: count-messages + description: "" +spec_version: v2 +spec: + type: SQL + sql: INSERT INTO msg_count SELECT COUNT(*) AS ct FROM envoy + execution: + active: false + task_count: 1 + task_size: M