Skip to content

main into release

main into release #2

# This GitHub workflow validates Bundle config (ML asset config and more)
# defined under mlops_stacks_gcp_fs/assets/*
# and mlops_stacks_gcp_fs/databricks.yml, when PRs are merged into the main branch
name: Bundle validation for mlops_stacks_gcp_fs
on:
workflow_dispatch:
pull_request_target:
defaults:
run:
working-directory: ./mlops_stacks_gcp_fs/
env:
STAGING_WORKSPACE_TOKEN: ${{ secrets.STAGING_WORKSPACE_TOKEN }}
PROD_WORKSPACE_TOKEN: ${{ secrets.PROD_WORKSPACE_TOKEN }}
jobs:
staging:
concurrency: mlops_stacks_gcp_fs-staging-bundle-job
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: databricks/setup-cli@v0.211.0
- name: Validate Bundle For Staging
id: validate
env:
DATABRICKS_TOKEN: ${{ env.STAGING_WORKSPACE_TOKEN }}
run: |
databricks bundle validate -t staging > ../validate_output.txt
- name: Create Comment with Bundle Configuration
uses: actions/github-script@v6
id: comment
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const fileContents = fs.readFileSync('validate_output.txt', 'utf8');
const output = `#### Bundle Staging Config Validated 🖌
<details><summary>Staging Validation Output</summary>
\`\`\`\n
${fileContents}
\`\`\`
</details>`
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
prod:
concurrency: mlops_stacks_gcp_fs-prod-bundle-job
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- uses: databricks/setup-cli@v0.211.0
- name: Validate Bundle For Prod
id: validate
env:
DATABRICKS_TOKEN: ${{ env.PROD_WORKSPACE_TOKEN }}
run: |
databricks bundle validate -t prod > ../validate_output.txt
- name: Create Comment with Bundle Configuration
uses: actions/github-script@v6
id: comment
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const fileContents = fs.readFileSync('validate_output.txt', 'utf8');
const output = `#### Bundle Prod Config Validated 🖌
<details><summary>Prod Validation Output</summary>
\`\`\`\n
${fileContents}
\`\`\`
</details>`
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})