Skip to content

testing pull request #8

testing pull request

testing pull request #8

# This GitHub workflow validates Bundle config (ML resource config and more)
# defined under imh_mlops_stack/resources/*
# and imh_mlops_stack/bundle.yml, when PRs are merged into the main branch
#
name: Bundle validation for imh-mlops-stack
on:
workflow_dispatch:
pull_request_target:
defaults:
run:
working-directory: ./imh_mlops_stack/
env:
#STAGING_ARM_TENANT_ID: ${{ secrets.STAGING_AZURE_SP_TENANT_ID }}
#STAGING_ARM_CLIENT_ID: ${{ secrets.STAGING_AZURE_SP_APPLICATION_ID }}
#STAGING_ARM_CLIENT_SECRET: ${{ secrets.STAGING_AZURE_SP_CLIENT_SECRET }}
#PROD_ARM_TENANT_ID: ${{ secrets.PROD_AZURE_SP_TENANT_ID }}
#PROD_ARM_CLIENT_ID: ${{ secrets.PROD_AZURE_SP_APPLICATION_ID }}
#PROD_ARM_CLIENT_SECRET: ${{ secrets.PROD_AZURE_SP_CLIENT_SECRET }}
DATABRICKS_HOST: https://adb-8590162618558854.14.azuredatabricks.net
DATABRICKS_TOKEN : ${{ secrets.DB_TOKEN }}
jobs:
staging:
concurrency: imh-mlops-stack-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@main
- name: Create profile
id: create_profile
run:
databricks configure --profile "dbprofile" --host ${{env.DATABRICKS_HOST}} --token ${{env.DATABRICKS_TOKEN}}
- name: Validate Bundle For Staging
id: validate
#env:
#ARM_TENANT_ID: ${{ env.STAGING_ARM_TENANT_ID }}
#ARM_CLIENT_ID: ${{ env.STAGING_ARM_CLIENT_ID }}
#ARM_CLIENT_SECRET: ${{ env.STAGING_ARM_CLIENT_SECRET }}
run:
databricks bundle validate -t staging --profile dbprofile > ../validate_output.txt
- name: Create Comment with Bundle Configuration
uses: actions/github-script@v6
id: comment
with:
github-token: ${{ secrets.GIT_HUB_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: imh-mlops-stack-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@main
- name: Validate Bundle For Prod
id: validate
#env:
#ARM_TENANT_ID: ${{ env.PROD_ARM_TENANT_ID }}
#ARM_CLIENT_ID: ${{ env.PROD_ARM_CLIENT_ID }}
#ARM_CLIENT_SECRET: ${{ env.PROD_ARM_CLIENT_SECRET }}
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.GIT_HUB_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
})