tibotiber / hasura-action Goto Github PK
View Code? Open in Web Editor NEWGitHub Action wrapping the Hasura CLI
License: Other
GitHub Action wrapping the Hasura CLI
License: Other
I saw your comment "secrets can be printed, they are protected by Github Actions", but sometimes they're not. We fetch the Admin secret from AWS Secrets Manager and add it to $GITHUB_ENV
.
Unless you have a better approach to this, maybe consider changing the echo
statement?
deploy_hasura_configuration:
name: Hasura Configuration
needs: deploy_backend
runs-on: ubuntu-latest
env:
HASURA_ENDPOINT: ...
HASURA_WORKDIR: ...
# HASURA_ADMIN_SECRET is added to env in the steps below.
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Configure AWS Creds (Development)
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::...
aws-region: eu-central-1
- name: Retrieve and set Hasura admin secret
run: |
secret_info=$(aws secretsmanager get-secret-value --region ... --secret-id ... --output text)
read -ra secret_values <<< "$secret_info"
echo "HASURA_ADMIN_SECRET=${secret_values[3]}" >> $GITHUB_ENV
- name: Apply database migrations
uses: tibotiber/hasura-action@master
with:
args: migrate apply
- name: Apply metadata
uses: tibotiber/hasura-action@master
with:
args: metadata apply
Problem:
Hasura cloud is currently returning 2.15.2
which is not a valid CLI version (yet?), thus the action fails completely for me.
GET https://{...}.hasura.app/v1/version
{"version":"v2.15.2-cloud.1"}
Since the action always looks for an update:
hasura update-cli --version 2.15.2
FATA[0000] apply update: download asset: could not find the release asset
I suggest if this error happens to catch it and try to execute the command anyway.
Thank you for making this github action. As of ~10 days ago, it has started failing with the following error:
parse error: Invalid numeric literal at line 1, column 7
on running hasura metadata apply
I believe that it's due to taking the latest version of graphql-engine here, and there being a non-backward compatible change in the latest version of hasura graphql (v2.1.0)
Is it possible to use this github action to a fixed version of hasura graphql?
I'm getting the following error trying to apply metadata from github actions:
Executing 'hasura metadata apply --endpoint *** --admin-secret ***' from './'
sh: syntax error: unexpected word (expecting ")")
Here's the relevant config:
defaults:
run:
shell: bash
jobs:
update_graphql:
name: Update Hasura Metadata
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Apply hasura metadata
uses: tibotiber/hasura-action@master
with:
args: metadata apply
env:
HASURA_ENDPOINT: ${{ secrets.HASURA_ENDPOINT }}
HASURA_ADMIN_SECRET: ${{ secrets.HASURA_ADMIN_SECRET }}
Metadata is in the default location ./migrations/metadata.yaml
at the root of the project repo.
First thanks a ton for making this addon! It has been extremely helpful for testing hasura apps 😄
I'm loading migrations and metadata that are checked into my repo, so in order to get the hasura instance running correctly I have to run: metadata clear
, migrate apply
, and metadata apply
.
I'm wondering if there's a way I can run all three of these using a single step in my yaml file? Right now I have a bit of repetition for these three commands:
- name: Setup Hasura metadata clear
uses: tibotiber/hasura-action@master
with:
args: metadata clear
env:
HASURA_ENDPOINT: http://hasura:8080
HASURA_ADMIN_SECRET: secret
HASURA_WORKDIR: test/hasura
HASURA_ENGINE_VERSION: v2.0.10
- name: Setup Hasura migrations
uses: tibotiber/hasura-action@master
with:
args: migrate apply --database-name default
env:
HASURA_ENDPOINT: http://hasura:8080
HASURA_ADMIN_SECRET: secret
HASURA_WORKDIR: test/hasura
HASURA_ENGINE_VERSION: v2.0.10
- name: Setup Hasura metadata apply
uses: tibotiber/hasura-action@master
with:
args: metadata apply
env:
HASURA_ENDPOINT: http://hasura:8080
HASURA_ADMIN_SECRET: secret
HASURA_WORKDIR: test/hasura
HASURA_ENGINE_VERSION: v2.0.10
Do you have any ideas how I could run all there of these as a single step? If not, would you be open to a PR that allowed this?
I am using Hasura actions with an ACTION_BASE_ENDPOINT. I am trying to create a GitHub workflow using this action. My action code looks like the following:
name: Hasura migration
on:
push:
branches:
- master
jobs:
hasura_migration:
name: Hasura migration
runs-on: ubuntu-latest
env:
HASURA_ENDPOINT: ${{ secrets.HASURA_ENDPOINT }}
HASURA_ADMIN_SECRET: ${{ secrets.HASURA_ADMIN_SECRET }}
ACTION_BASE_ENDPOINT: ${{ secrets.ACTION_BASE_ENDPOINT }}
HASURA_WORKDIR: packages/hasura/hasura # replace this by your own path if needed
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Echo env
run: echo $ACTION_BASE_ENDPOINT $HASURA_ENDPOINT $HASURA_ADMIN_SECRET
- name: Apply hasura migrations
uses: tibotiber/hasura-action@master
with:
args: migrate apply
- name: Apply hasura metadata
uses: tibotiber/hasura-action@master
with:
args: metadata apply
When it runs, I get the following error:
HasuraError.internal of type hasuradb.SQLInternalError; response from API: {\"internal\":[{\"definition\":{\"definition\":{\"kind\":\"synchronous\",\"output_type\":\"Result\",\"arguments\":[{\"name\":\"accountData\",\"type\":\"AccountData!\",\"description\":null}],\"headers\":[],\"handler\":\"{{ACTION_BASE_ENDPOINT}}/link-account\",\"type\":\"mutation\",\"forward_client_headers\":true},\"name\":\"linkAccount\",\"comment\":null},\"reason\":\"in action \\\"linkAccount\\\"; Value for environment variables not found: ACTION_BASE_ENDPOINT\",\"type\":\"action\"},
I don't understand why the ACTION_BASE_ENDPOINT var isn't being set. Does it need to be passed through to the script within the workflow action itself?
Hi, I'm trying to setup github action with this action but I'm having this issue saying --database-name flag is required. Someone know what's the potential issue?
time="2022-05-25T16:26:56Z" level=fatal msg="--database-name flag is required"
--database-name is now a required field.
https://hasura.io/docs/latest/graphql/core/migrations/upgrade-v3/#changes-needed-in-existing-workflows
{"level":"info","msg":"Help us improve Hasura! The cli collects anonymized usage stats which\nallow us to keep improving Hasura at warp speed. To opt-out or read more,\nvisit https://hasura.io/docs/1.0/graphql/manual/guides/telemetry.html\n","time":"2020-07-28T19:05:02Z"}
{"level":"info","msg":"Checking for update... ","time":"2020-07-28T19:05:02Z"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x758106]
goroutine 1 [running]:
github.com/Masterminds/semver.(*Version).Major(...)
/go/pkg/mod/github.com/!masterminds/[email protected]/version.go:131
github.com/Masterminds/semver.(*Version).Compare(0x0, 0xc0000beeb0, 0x0)
/go/pkg/mod/github.com/!masterminds/[email protected]/version.go:268 +0x26
github.com/Masterminds/semver.(*Version).GreaterThan(...)
/go/pkg/mod/github.com/!masterminds/[email protected]/version.go:250
github.com/hasura/graphql-engine/cli/update.HasUpdate(0xc0000beeb0, 0xc0003ef770, 0x29, 0xfb1300, 0x0, 0xc0002b1a00, 0x0, 0x0, 0x0)
/root/graphql-engine/cli/update/update.go:98 +0x12d
github.com/hasura/graphql-engine/cli/commands.(*updateOptions).run(0xc000561c70, 0x1, 0xc00031dc01, 0xc6f497)
/root/graphql-engine/cli/commands/update-cli.go:75 +0x5fc
github.com/hasura/graphql-engine/cli/commands.glob..func1(0xc000169b80, 0xc0000b5ac0, 0x0, 0x4)
/root/graphql-engine/cli/commands/root.go:42 +0xc3
github.com/hasura/graphql-engine/cli/commands.NewMetadataCmd.func1(0xc000169b80, 0xc0000b5ac0, 0x0, 0x4, 0x0, 0x0)
/root/graphql-engine/cli/commands/metadata.go:20 +0x79
github.com/spf13/cobra.(*Command).execute(0xc000169b80, 0xc0000b5a80, 0x4, 0x4, 0xc000169b80, 0xc0000b5a80)
/go/pkg/mod/github.com/spf13/[email protected]/command.go:805 +0x56b
github.com/spf13/cobra.(*Command).ExecuteC(0x19da780, 0xc00016dbc0, 0xc0000b6000, 0x7)
/go/pkg/mod/github.com/spf13/[email protected]/command.go:914 +0x2fb
github.com/hasura/graphql-engine/cli/commands.Execute(0xc000084058, 0x0)
/root/graphql-engine/cli/commands/root.go:119 +0x13a
main.main()
/root/graphql-engine/cli/cmd/hasura/hasura.go:11 +0x22
I think it is possible to detect the version of the user's target hasura endpoint https://hasura.io/docs/latest/graphql/core/api-reference/version.html#endpoint then make the action pull the correct version of the cli. This would allow users to not worry about changing the HASURA_ENGINE_VERSION
configuration if they want to update their server.
I've got this running fine for applying migrations, but when applying metadata I get this error: level=fatal msg="failed to apply metadata: cannot apply metadata on the database: cannot build actions from metadata: error in converting sdl to metadata: fork/exec /github/home/.hasura/plugins/bin/hasura-cli_ext: no such file or directory:"
.
I think it's because the Hasura CLI is failing to install the plugin needed for parsing metadata, but I'm not sure. Is this something you've encountered?
Actually the logs seem to suggest the plugin is successfully installed, but the Hasura CLI can't find it.
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 139 100 139 0 0 1561 0 --:--:-- --:--:-- --:--:-- 1561
--> Getting latest version...
100 3482 100 3482 0 0 19131 0 --:--:-- --:--:-- --:--:-- 19131
-->
--> Failed while attempting to install hasura graphql-engine cli. Please manually install:
-->
--> 2. Open your web browser and go to https://github.com/hasura/graphql-engine/releases
--> 2. Download the cli from latest release for your platform. Name it 'hasura'.
--> 3. chmod +x ./hasura
--> 4. mv ./hasura /usr/local/bin
-->
FAILED> exiting...
The command '/bin/sh -c curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash' returned a non-zero code: 1
##[error]Docker build failed with exit code 1
We see segmentation fault when applying metadata from a github action:
{"level":"info","msg":"Applying metadata...","time":"2022-01-10T17:45:01Z"}
21
time="2022-01-10T17:45:02Z" level=fatal msg="error applying metadata \ncannot build actions from project: error parsing metadata \nobject: actions\nfile: actions.yaml\nerror: error in converting sdl to metadata: signal: segmentation fault (core dumped): /github/home/.hasura/cli-ext/v2.0.9/cli-ext-730925829/cli-ext: /usr/lib/libstdc++.so.6: no version information available (required by /github/home/.hasura/cli-ext/v2.0.9/cli-ext-730925829/cli-ext
Digging into the build of the action container I see
2022-01-10T17:44:44.0128890Z Step 9/14 : RUN apk add --no-cache curl bash libstdc++ jq
2022-01-10T17:44:44.0305814Z ---> Running in f22c095441c3
2022-01-10T17:44:44.3144479Z fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
2022-01-10T17:44:44.4449166Z fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
2022-01-10T17:44:44.6575350Z (1/12) Installing ncurses-terminfo-base (6.3_p20211120-r0)
2022-01-10T17:44:44.6727502Z (2/12) Installing ncurses-libs (6.3_p20211120-r0)
2022-01-10T17:44:44.6910963Z (3/12) Installing readline (8.1.1-r0)
2022-01-10T17:44:44.7070337Z (4/12) Installing bash (5.1.8-r0)
2022-01-10T17:44:44.7328750Z Executing bash-5.1.8-r0.post-install
2022-01-10T17:44:44.7353334Z (5/12) Installing ca-certificates (20191127-r7)
2022-01-10T17:44:44.7633146Z (6/12) Installing brotli-libs (1.0.9-r5)
2022-01-10T17:44:44.7821824Z (7/12) Installing nghttp2-libs (1.46.0-r0)
2022-01-10T17:44:44.7958302Z (8/12) Installing libcurl (7.80.0-r0)
2022-01-10T17:44:44.8135866Z (9/12) Installing curl (7.80.0-r0)
2022-01-10T17:44:44.8293533Z (10/12) Installing oniguruma (6.9.7.1-r0)
2022-01-10T17:44:44.8505042Z (11/12) Installing jq (1.6-r1)
2022-01-10T17:44:44.8725818Z (12/12) Installing libstdc++ (10.3.1_git20211027-r0)
2022-01-10T17:44:44.9007027Z Executing busybox-1.34.1-r3.trigger
2022-01-10T17:44:44.9043636Z Executing ca-certificates-20191127-r7.trigger
2022-01-10T17:44:44.9411775Z Executing glibc-bin-2.34-r0.trigger
wheres our last successful run had
2022-01-10T07:32:01.0115679Z Step 9/14 : RUN apk add --no-cache curl bash libstdc++ jq
2022-01-10T07:32:01.0374367Z ---> Running in 83ba1d8d1007
2022-01-10T07:32:01.3500892Z fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
2022-01-10T07:32:01.4700518Z fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
022-01-10T07:32:01.7084359Z (1/12) Installing ncurses-terminfo-base (6.3_p20211120-r0)
2022-01-10T07:32:01.7207163Z (2/12) Installing ncurses-libs (6.3_p20211120-r0)
2022-01-10T07:32:01.7355017Z (3/12) Installing readline (8.1.1-r0)
2022-01-10T07:32:01.7554953Z (4/12) Installing bash (5.1.8-r0)
2022-01-10T07:32:01.7791060Z Executing bash-5.1.8-r0.post-install
2022-01-10T07:32:01.7811632Z (5/12) Installing ca-certificates (20191127-r7)
2022-01-10T07:32:01.8028805Z (6/12) Installing brotli-libs (1.0.9-r5)
2022-01-10T07:32:01.8201841Z (7/12) Installing nghttp2-libs (1.46.0-r0)
2022-01-10T07:32:01.8374849Z (8/12) Installing libcurl (7.80.0-r0)
2022-01-10T07:32:01.8523015Z (9/12) Installing curl (7.80.0-r0)
2022-01-10T07:32:01.8646382Z (10/12) Installing oniguruma (6.9.7.1-r0)
2022-01-10T07:32:01.8799539Z (11/12) Installing jq (1.6-r1)
2022-01-10T07:32:01.9002994Z (12/12) Installing libstdc++ (10.3.1_git20211027-r0)
2022-01-10T07:32:01.9819847Z Executing busybox-1.34.1-r3.trigger
2022-01-10T07:32:01.9859895Z Executing ca-certificates-20191127-r7.trigger
2022-01-10T07:32:02.0250041Z Executing glibc-bin-2.33-r0.trigger
2022-01-10T07:32:02.0266519Z �/usr/glibc-compat/sbin/ldconfig: /usr/glibc-compat/lib/ld-linux-x86-64.so.2 is not a symbolic link
So I think the github action environment got updated and broke things.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.