Skip to content

Commit

Permalink
Apply PR review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
abozaralizadeh committed Apr 29, 2024
1 parent b97f867 commit c155996
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
18 changes: 17 additions & 1 deletion .azure-pipelines/platform_ci_dev_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,23 @@ stages:
replace@youremail.com
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_prompt_flow.yml
parameters:
SUBSCRIPTION_ID: $(SUBSCRIPTION_ID)
flow_to_execute: ${{ parameters.flow_to_execute }}
DEPLOY_ENVIRONMENT: ${{ parameters.exec_environment }}
BUILD_ID: $(Build.Buildid)

- job: deploy_flow
dependsOn:
- ApproveDeployment
Expand Down
38 changes: 38 additions & 0 deletions .azure-pipelines/templates/publish_prompt_flow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
parameters:
- name: SUBSCRIPTION_ID
type: string
- name: flow_to_execute
type: string
- name: DEPLOY_ENVIRONMENT
type: string
- name: BUILD_ID
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.flow_to_execute }}/llmops_config.json"
env_name=${{ parameters.DEPLOY_ENVIRONMENT }}
selected_object=$(jq ".envs[] | select(.ENV_NAME == \"$env_name\")" "$config_path")
if [[ -n "$selected_object" ]]; then
echo "$selected_object"
RESOURCE_GROUP_NAME=$(echo "$selected_object" | jq -r '.RESOURCE_GROUP_NAME')
WORKSPACE_NAME=$(echo "$selected_object" | jq -r '.WORKSPACE_NAME')
STANDARD_FLOW_PATH=$(echo "$selected_object" | jq -r '.STANDARD_FLOW_PATH')
EVALUATION_FLOW_PATH=$(echo "$selected_object" | jq -r '.EVALUATION_FLOW_PATH')
else
echo "Object in config file not found"
fi
echo "Publishing standard flow..."
pfazure flow create --flow ./${{ parameters.flow_to_execute }}/$STANDARD_FLOW_PATH --set display_name=${{ parameters.flow_to_execute }}_standard:${{ parameters.BUILD_ID }} --set type=chat --subscription ${{ parameters.SUBSCRIPTION_ID }} --resource-group $RESOURCE_GROUP_NAME --workspace-name $WORKSPACE_NAME
if [[ -n "$EVALUATION_FLOW_PATH" ]]; then
echo "Publishing evaluation flow..."
pfazure flow create --flow ./${{ parameters.flow_to_execute }}/$EVALUATION_FLOW_PATH --set display_name=${{ parameters.flow_to_execute }}_evaluation:${{ parameters.BUILD_ID }} --set type=evaluation --subscription ${{ parameters.SUBSCRIPTION_ID }} --resource-group $RESOURCE_GROUP_NAME --workspace-name $WORKSPACE_NAME
fi

0 comments on commit c155996

Please sign in to comment.