dagster-io / dagster-cloud-action

Apache License 2.0
13 stars 20 forks source link

add flag to disable inner repo checkout #84

Closed slopp closed 1 year ago

slopp commented 1 year ago

Currently the Github actions checkout the target repo twice, once in the default workflows we provide as templates, and again inside the deploy actions.

The second checkout makes it hard for teams who want to use actions to customize the file structure prior to deployment. One common use case is copying a parent utilities folder into the dagster project's build directory.

This PR adds a flag that does not change the default behavior but allows users to disable the second checkout:

steps:
       # first checkout
      - name: Checkout
        uses: actions/checkout@v3
        with:
          ref: ${{ github.head_ref }}
      - name: Build and deploy to Dagster Cloud serverless
        uses: dagster-io/dagster-cloud-action/actions/serverless_prod_deploy@v0.1
        with:
          dagster_cloud_api_token: ${{ secrets.DAGSTER_CLOUD_API_TOKEN }}
          location: ${{ toJson(matrix.location) }}
          organization_id: ${{ secrets.ORGANIZATION_ID }}
          # disable checkout within the action
          checkout_repo: 'false'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Does anyone know an easy way to actually test this change? I couldn't figure out how... and I'm not 100% certain the syntax for referencing an input in the if clause is correct 😬

We could also base the flag off of an env reference instead of an input. But I like that inputs are documented.

github-actions[bot] commented 1 year ago

Your pull request is automatically being deployed to Dagster Cloud.

Location Status Link Updated
from_gh_action View in Cloud Jan 09, 2023 at 04:52 PM (UTC)
slopp commented 1 year ago

@gibsondan I think that would be a good potential follow up. I wanted to keep the existing behavior as the defaults for now, and then see if the new action will work in a few examples (both with custom GHAs and with our regular examples)

slopp commented 1 year ago

Ok I was able to fix the syntax and run a test:

With the inner checkout enabled, this action fails: https://github.com/slopp/dagteam/actions/runs/3876566174/jobs/6610560330#step:4:19

With the inner checkout disabled, the action succeeds: https://github.com/slopp/dagteam/actions/runs/3876592965/jobs/6610617344

slopp commented 1 year ago

There's also a release process for the action to make it what everybody points at by default @gibsondan I think this PR is ready for that process