GithubHelp home page GithubHelp logo

jonico / pscale-workflow-helper-scripts Goto Github PK

View Code? Open in Web Editor NEW
77.0 4.0 8.0 160 KB

Workflows and helper scripts around the PlanetScale DB workflow to automate database branch creation, association, update and merge directly out of your pull/merge request or favourite CI/CD. This is just a passion project, no official repository from Planetscale.

Home Page: https://youtu.be/l3oe7srRUZw?t=610

Shell 100.00%
planetscale cli helper synchronous wait credentials actions zerosetup issueops pull-requests

pscale-workflow-helper-scripts's Issues

Error: both --service-token and --service-token-id are required for service token authentication

Basically its not possible to use pscale CLI within github action. In this example im using create-deploy-request function in ps-create-helper-functions.sh

As you can see below, the user gets authenticated, however requests for authentication anyways
image

I`m able to perform the same action locally
image

There is any new business rule that doest not allow to use CLI in CI/CD?

Job:

jobs:
  deploy-planetscale:
    name: Planetscale deploy
    runs-on: ubuntu-latest
    #container: node:latest
    steps:
      - name: checkout
        uses: actions/checkout@v2

      - name: Apply database migrations in pre-deploy database branch
        timeout-minutes: 3
      # - shell: bash
        env:
          DATABASE_URL: ${{ secrets.DATABASE_URL }}
          PLANETSCALE_SERVICE_TOKEN_ID: ${{secrets.PLANETSCALE_SERVICE_TOKEN_ID}}
          PLANETSCALE_SERVICE_TOKEN_NAME: ${{secrets.PLANETSCALE_SERVICE_TOKEN_NAME}}
          PLANETSCALE_SERVICE_TOKEN: ${{secrets.PLANETSCALE_SERVICE_TOKEN}}
          ORG_NAME: ${{secrets.ORG_NAME}}
          DB_NAME: ${{secrets.DB_NAME}}
          BRANCH_NAME: pre-deploy

        run: |
          ./scripts/deploy-database-staging.sh

deploy-database-staging.sh

#!/bin/bash
. ./scripts/planetscale-docker-image.sh

unset PLANETSCALE_SERVICE_TOKEN
. ./scripts/authenticate-planetscale.sh

#npm i -g prisma >3
#prisma db push --skip-generate

. ./scripts/planetscale-helper-functions.sh
create-deploy-request "$DB_NAME" "$BRANCH_NAME" "$ORG_NAME"
create-deployment "$DB_NAME" "$ORG_NAME" "$DEPLOY_REQUEST_NUMBER"

Obs: All env vars are set propelly

issue running export-db-connection-string.sh and accessing the output

Good Morning,

I am trying to run export-db-connection-string.sh (https://github.com/jonico/pscale-workflow-helper-scripts/blob/main/.pscale/cli-helper-scripts/export-db-connection-string.sh) within my yml file:
image

this is the error I get in GitHub:
image

furthermore, after I have successfully managed to run the script, I would need to store the output (connection string) as a global variable, so that i can use it in the next job (docker build), what is the correct way to access "set-output name=dbconnection_${i}_${j}" within my yml file

Kind Regards
AAACafe

Branch diff is always null

I'm able to successfully attach and update a PR with a Planetscale DR using the issue-ops-ps-commands /ps-attach and /ps-update, however the Branch diff is always null.

Even thought the workflow job passes (green), I also get the following error {"error": "deploy request 'myapp/7' does not exist in organization my-org"}. This DR does indeed exist, and has schema changes, so I'm unsure where the issue stems from. Note that I am only using the issue-ops-ps-commands.yml workflow along with the directory of .pscale shell commands.

Prisma Example

This is fantastic. Thanks for putting this out there! Super helpful. Are you planning on adding an example demoing something like this with Prisma in CI/CD pipeline? If not, I could maybe throw something together and submit a PR.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.