Skip to content

Commit da1371a

Browse files
authored
Decodable GH actions example (#23)
* CICD WIP * move workflow * WIP * WIP * Add README * Update index
1 parent 1f8a8d6 commit da1371a

File tree

5 files changed

+92
-0
lines changed

5 files changed

+92
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ _Decodable provides a managed PyFlink service. Learn more [here](https://docs.de
8989

9090
| Example | Description |
9191
|-------------------------------------------------------|-------------|
92+
| [Decodable CI/CD](declarative-cicd) | An example of using Decodable with GitHub Actions|
9293
| [Decodable CLI Docker image](cli-docker) | An example Dockerfile for running the Decodable CLI under Docker.|
9394

9495
## License

declarative-cicd/README.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
= Using Decodable with GitHub Actions
2+
3+
The folder shows an example of how you can integrate Decodable with your CICD workflow using GitHub Actions.
4+
5+
Refer to https://docs.decodable.co/cli/integrate-with-github-actions.html[the documentation page] for details.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
kind: connection
3+
metadata:
4+
name: datagen-01
5+
description: ""
6+
spec_version: v2
7+
spec:
8+
connector: datagen
9+
type: source
10+
stream_name: envoy
11+
schema_v2:
12+
fields:
13+
- kind: physical
14+
name: message
15+
type: STRING
16+
constraints: {}
17+
properties:
18+
delay: "5000"
19+
format: json
20+
data.type: envoy
21+
execution:
22+
active: true
23+
task_count: 1
24+
task_size: M
25+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Deploy Decodable resources
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
# pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
setup-and-apply:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v2
17+
18+
- name: Download and unpack the Decodable CLI
19+
run: |
20+
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 && \
21+
tar -xzf /tmp/decodable-cli.tar.gz -C /tmp && \
22+
sudo mv /tmp/decodable-cli-linux-amd64-1.20.0/bin/decodable /usr/local/bin && \
23+
rm -r /tmp/decodable-cli.tar.gz /tmp/decodable-cli-linux-amd64-1.20.0
24+
25+
- name: Create Decodable CLI auth file
26+
run: |
27+
mkdir -p ~/.decodable
28+
cat <<EOF > ~/.decodable/auth
29+
version: 1.0.0
30+
tokens:
31+
default:
32+
refresh_token: ${{ secrets.DECODABLE_REFRESH_TOKEN }}
33+
EOF
34+
35+
- name: Create Decodable CLI config file
36+
run: |
37+
mkdir -p ~/.decodable
38+
cat <<EOF > ~/.decodable/config
39+
version: 1.0.0
40+
active-profile: default
41+
42+
profiles:
43+
default:
44+
account: ${{ vars.DECODABLE_ACCOUNT_NAME }}
45+
EOF
46+
47+
- name: Apply all Decodable resources
48+
run: decodable apply $(find declarative-cicd -name '*.yaml')
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
kind: pipeline
3+
metadata:
4+
name: count-messages
5+
description: ""
6+
spec_version: v2
7+
spec:
8+
type: SQL
9+
sql: INSERT INTO msg_count SELECT COUNT(*) AS ct FROM envoy
10+
execution:
11+
active: false
12+
task_count: 1
13+
task_size: M

0 commit comments

Comments
 (0)