Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Publish Flow Feature (Revised) #136

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .azure-pipelines/platform_ci_dev_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ stages:
# Manual Approval is enabled by default
# For removal of Manual Approval:
# Remove the job ApproveDeployment
# and remove its dependency from job deploy_flow
# and remove its dependency from job deploy_flow and publish_flow
#=====================================
jobs:
- job: ApproveDeployment
Expand All @@ -165,7 +165,25 @@ stages:
[email protected]
instructions: "$(run_id_from_submit_job)"
onTimeout: 'reject'


#=====================================
# Publish the flow in promptflow blade
#=====================================
- job: publish_flow
dependsOn:
- ApproveDeployment
steps:
- template: templates/get_connection_details.yml
- template: templates/configure_azureml_agent.yml
- template: templates/publish_promptflow.yml
parameters:
SUBSCRIPTION_ID: $(SUBSCRIPTION_ID)
USE_CASE_BASE_PATH: ${{ parameters.use_case_base_path }}
DEPLOY_ENVIRONMENT: ${{ parameters.exec_environment }}
BUILD_ID: $(Build.Buildid)
WORKSPACE_NAME: ${{ parameters.WORKSPACE_NAME }}
RESOURCE_GROUP_NAME: ${{ parameters.RESOURCE_GROUP_NAME }}

- job: deploy_flow
dependsOn:
- ApproveDeployment
Expand Down
30 changes: 30 additions & 0 deletions .azure-pipelines/templates/publish_promptflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
parameters:
- name: SUBSCRIPTION_ID
type: string
- name: USE_CASE_BASE_PATH
type: string
- name: DEPLOY_ENVIRONMENT
type: string
- name: BUILD_ID
type: string
- name: WORKSPACE_NAME
type: string
- name: RESOURCE_GROUP_NAME
type: string

steps:
- task: AzureCLI@2
displayName: Publish Prompt Flow
continueOnError: false
inputs:
azureSubscription: $(AZURE_RM_SVC_CONNECTION)
scriptType: bash
workingDirectory: $(System.DefaultWorkingDirectory)
scriptLocation: inlineScript
inlineScript: |
config_path="./${{ parameters.USE_CASE_BASE_PATH }}/experiment.yaml"
STANDARD_FLOW_NAME="${"$(cat $config_path | yq .flow)"/"flows\/"/""}"
STANDARD_FLOW_PATH="./${{ parameters.USE_CASE_BASE_PATH }}/$(cat $config_path | yq .flow)"

echo "Publishing standard flow..."
pfazure flow create --flow $STANDARD_FLOW_PATH --set display_name="${{ parameters.USE_CASE_BASE_PATH }}"_"$STANDARD_FLOW_NAME":${{ parameters.BUILD_ID }} --set type=chat --subscription ${{ parameters.SUBSCRIPTION_ID }} --resource-group ${{ parameters.RESOURCE_GROUP_NAME }} --workspace-name ${{ parameters.WORKSPACE_NAME }}