Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ steps:
influxdb_user: ci_user
influxdb_password: password
influxdb_bucket: dummy
```
influxdb_token: apitoken
```
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ inputs:
influxdb_start:
description: 'Set to false if you only need to use the cli tools without a locally running InfluxDB instance. If this is false, you can ignore the init parameters.'
required: false
default: true
default: 'true'
influxdb_org:
description: 'The initial Organization of the InfluxDB instance.'
required: false
Expand All @@ -27,6 +27,9 @@ inputs:
description: 'The initial Bucket of the InfluxDB instance.'
required: false
default: 'bucket'
influxdb_token:
description: 'The initial API Token of the InfluxDB instance.'
required: false
runs:
using: "composite"
steps:
Expand All @@ -42,6 +45,8 @@ runs:
export INFLUXDB_USER=${{inputs.influxdb_user}}
export INFLUXDB_PASSWORD=${{inputs.influxdb_password}}
export INFLUXDB_BUCKET=${{inputs.influxdb_bucket}}
export INFLUXDB_TOKEN=${{inputs.influxdb_token}}
${{ github.action_path }}/setup-influxdb.sh
unset INFLUXDB_PASSWORD
unset INFLUXDB_TOKEN
shell: bash
18 changes: 13 additions & 5 deletions setup-influxdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@ if [ "$INFLUXDB_START" = "true" ]
then
influxd --http-bind-address :8086 --reporting-disabled > /dev/null 2>&1 &
until curl -s http://localhost:8086/health; do sleep 1; done
influx setup --host http://localhost:8086 -f \
-o $INFLUXDB_ORG \
-u $INFLUXDB_USER \
-p $INFLUXDB_PASSWORD \
-b $INFLUXDB_BUCKET
if [ -z ${INFLUXDB_TOKEN+x} ];
then influx setup --host http://localhost:8086 -f \
-o $INFLUXDB_ORG \
-u $INFLUXDB_USER \
-p $INFLUXDB_PASSWORD \
-b $INFLUXDB_BUCKET
else influx setup --host http://localhost:8086 -f \
-o $INFLUXDB_ORG \
-u $INFLUXDB_USER \
-p $INFLUXDB_PASSWORD \
-b $INFLUXDB_BUCKET \
-t $INFLUXDB_TOKEN
fi
fi