Skip to content

CmdLets should emit an Warning or error if enabled trigger does not have pipeline references #435

@jikuja

Description

@jikuja

Describe the bug

Enabled triggers without pipeline references are not handled properly

On UX Data Factory validation blocks publish for triggers that are enabled wihtout pipeline references:

image

  • Test-AdfCode does not generate any warning for the trigger
  • Publish-AdfV2FromJson tries to to start the trigger, fails

To Reproduce

trigger JSON

{
	"name": "fail",
	"properties": {
		"description": "Backend will fail with this",
		"annotations": [],
		"runtimeState": "Started",
		"pipelines": [
		],
		"type": "ScheduleTrigger",
		"typeProperties": {
			"recurrence": {
				"frequency": "Week",
				"interval": 1,
				"startTime": "2023-02-15T19:32:00",
				"timeZone": "FLE Standard Time",
				"schedule": {
					"minutes": [
						11
					],
					"hours": [
						5
					],
					"weekDays": [
						"Thursday",
						"Friday",
						"Monday",
						"Tuesday",
						"Wednesday"
					]
				}
			}
		}
	}
}

Test-AdfCode does not generate any warning for the trigger

Publish-AdfV2FromJson tries to to start the trigger, fails

The number of triggers to start: 9
Starting triggers:
- Enabling trigger: fail
Start-AzDataFactoryV2Trigger: /Users/janne.kujanpaa/.local/share/powershell/Modules/azure.datafactory.tools/1.11.2/private/Start-Trigger.ps1:17:13
Line |
  17 |              Start-AzDataFactoryV2Trigger `
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | HTTP Status Code: BadRequest Error Code: BadRequest Error Message: Missing or invalid pipeline references for trigger fail Request Id:
     | 7f4324c5-5f97-4acf-9777-805d34405bb5 Timestamp (Utc):12/15/2024 17:54:44
Start-AzDataFactoryV2Trigger: /Users/janne.kujanpaa/.local/share/powershell/Modules/azure.datafactory.tools/1.11.2/private/Start-Trigger.ps1:17:13
Line |
  17 |              Start-AzDataFactoryV2Trigger `
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | HTTP Status Code: BadRequest Error Code: BadRequest Error Message: Missing or invalid pipeline references for trigger fail Request Id:
     | e644ca62-59c0-42a5-9c8e-ba048608e220 Timestamp (Utc):12/15/2024 17:54:44
Start-AzDataFactoryV2Trigger: /Users/janne.kujanpaa/.local/share/powershell/Modules/azure.datafactory.tools/1.11.2/private/Start-Trigger.ps1:17:13
Line |
  17 |              Start-AzDataFactoryV2Trigger `
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | HTTP Status Code: BadRequest Error Code: BadRequest Error Message: Missing or invalid pipeline references for trigger fail Request Id:
     | abca1459-a823-4904-908f-dad36a49da36 Timestamp (Utc):12/15/2024 17:54:45
Start-AzDataFactoryV2Trigger: /Users/janne.kujanpaa/.local/share/powershell/Modules/azure.datafactory.tools/1.11.2/private/Start-Trigger.ps1:17:13
Line |
  17 |              Start-AzDataFactoryV2Trigger `
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | HTTP Status Code: BadRequest Error Code: BadRequest Error Message: Missing or invalid pipeline references for trigger fail Request Id:
     | 53b314c9-be6c-4472-a36e-85b3c1338043 Timestamp (Utc):12/15/2024 17:54:46
Start-AzDataFactoryV2Trigger: /Users/janne.kujanpaa/.local/share/powershell/Modules/azure.datafactory.tools/1.11.2/private/Start-Trigger.ps1:17:13
Line |
  17 |              Start-AzDataFactoryV2Trigger `
     |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | HTTP Status Code: BadRequest Error Code: BadRequest Error Message: Missing or invalid pipeline references for trigger fail Request Id:
     | 970fbf7e-59ba-4aa4-b993-c71342849ae8 Timestamp (Utc):12/15/2024 17:54:46
- Enabling trigger: Monthly - End of the Month

Expected behaviour

  • Test-AdfCode should emit an warning
  • Publish-AdfV2FromJson should have better indications of the failure to fail the running pipeline

More details

For me it looks like Start-Trigger error handling is not working like it should.

E.g. Write-Host and Write-Warning output are missing

                Write-Host "Failed starting trigger after $attempts attempts."
                Write-Warning -Message $_.Exception.Message

More details 2

Variables are empty if passing -ErrorVariable ev -WarningVariable wv to Publish-AdfV2FromJson

More details 3

Publish-AdfV2FromJson -ErrorVariable ev -WarningVariable wv -ErrorAction 'Stop' is a partial workaround to emit a failure when underlying API calls fails. As side-effect other failing code on our use-case causes early termination and triggers are not started again.

AFAIK error handling code on Start-Trigger should catch the errors when -ErrorAction 'Stop' is used

Version of PowerShell module of:

  • 1.11.2

Metadata

Metadata

Assignees

Labels

triageIssue is under investigation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions