Skip to content

Commit

Permalink
Publish flow feature
Browse files Browse the repository at this point in the history
Adopted to YAML configuration
  • Loading branch information
abozaralizadeh committed May 22, 2024
1 parent e327973 commit d0f4c6b
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
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 }}

0 comments on commit d0f4c6b

Please sign in to comment.