Set up CI with Azure Pipelines

[skip ci]
This commit is contained in:
2023-07-27 11:59:46 +02:00
parent 20cc9614f6
commit f5bb9b66b5

102
azure-pipelines.yml Normal file
View File

@@ -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 = ' <html><body><p>Résumé des erreurs dans le tableau ci-dessous : </p>' +'
<table border="1" width="400px" height="400px">
<tr>
<th>ErrorNumber</th>
<th>ErrorSeverity</th>
<th>ErrorState</th>
<th>ErrorProcedure</th>
<th>ErrorLine</th>
<th>ErrorMessage</th>
</tr>' + '<tr valign="center">
<td>' + isnull(convert(varchar, ERROR_NUMBER()), '') + '</td>
<td>' + isnull(convert(varchar, ERROR_SEVERITY()), '') + '</td>
<td>' + isnull(convert(varchar, ERROR_STATE()), '') + '</td>
<td>' + isnull(ERROR_PROCEDURE(), '') + '</td>
<td>' + isnull(convert(varchar, ERROR_LINE()), '') + '</td>
<td>' + isnull(ERROR_MESSAGE(), '') + '</td>
</tr>'+ '
</table>
</body>
</html>';
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'