diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..2912ba8 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,102 @@ +# Starter pipeline + + +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +trigger: +- main + +pool: + vmImage: ubuntu-latest + +steps: +- task: SqlDacpacDeploymentOnMachineGroup@0 + displayName: _D03091 - INDEX - Load items CDS and prescribers from PharmIndex to Arizona - Central + inputs: + TaskType: 'sqlInline' + InlineSql: | + use pharmindexTP + GO + + /* step 1 - Check download from Pharmindex is finished */ + + + declare @today datetime; + + select @today = convert(datetime, convert(varchar(20), getdate(),102)) + + if not exists ( select top 1 * + from BatchImportHistory bih + where bih.Success = 1 + and bih.EndImportDate > @today) + begin /* Download not OK */ + + raiserror('Pharmindex download in process, job not executed', 16,1) + + end; + + GO + + +begin try + +declare @out_param_int_1 int +execute[dbo].[pdx_loading] + @in_job_type = 20 + ,@skip_mapping = 0 + ,@in_subsidiary = 100 + ,@in_table_name = null + ,@in_debug = 0 + ,@out_param_int_1 = @out_param_int_1 output + +end try +begin catch +declare + @mail_message nvarchar(2000), + @mail_subject nvarchar(255); + set @mail_message = '
Résumé des erreurs dans le tableau ci-dessous :
' +' +| ErrorNumber | +ErrorSeverity | +ErrorState | +ErrorProcedure | +ErrorLine | +ErrorMessage | +
|---|---|---|---|---|---|
| ' + isnull(convert(varchar, ERROR_NUMBER()), '') + ' | +' + isnull(convert(varchar, ERROR_SEVERITY()), '') + ' | +' + isnull(convert(varchar, ERROR_STATE()), '') + ' | +' + isnull(ERROR_PROCEDURE(), '') + ' | +' + isnull(convert(varchar, ERROR_LINE()), '') + ' | +' + isnull(ERROR_MESSAGE(), '') + ' | +