From f5bb9b66b5949985e3ce2bdee62b1147d38aa912 Mon Sep 17 00:00:00 2001 From: tschork Date: Thu, 27 Jul 2023 11:59:46 +0200 Subject: [PATCH] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 102 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 azure-pipelines.yml 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 :

' +' + + + + + + + + + ' + ' + + + + + + + '+ ' +
ErrorNumberErrorSeverityErrorStateErrorProcedureErrorLineErrorMessage
' + 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(), '') + '
+ + '; + + set @mail_subject = 'INDEX - Transfert PharmIndex to PHGD_xx for items using checksum (Instance ' + @@SERVERNAME + ') - Job _D01941 - INDEX'; + +/* envoi du mail */ +exec Arizona.dbo.aps_Send_Mail_with_template + @in_param_varchar_2 = 'HCI_PharmIndex;HCI_DataManagement', + @in_param_varchar_3 = @mail_message, + @in_param_subject = @mail_subject, + @in_job_type = 4; + +end catch + + + ServerName: 'localhost' + DatabaseName: 'master' + AuthScheme: 'windowsAuthentication' + +- script: echo Hello, world! + displayName: 'Run a one-line script' + +- script: | + echo Add other tasks to build, test, and deploy your project. + echo See https://aka.ms/yaml + displayName: 'Run a multi-line script'