From dc8969c5b6bbc6915f3f6ac467f1b3faccb5ed31 Mon Sep 17 00:00:00 2001 From: Karl-G1 Date: Thu, 8 Jun 2023 10:29:41 -0500 Subject: [PATCH 1/5] Enable error reporting on diff pipeline powershell calls --- azure-templates/steps-diff.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/azure-templates/steps-diff.yml b/azure-templates/steps-diff.yml index 0222985c..dc4ac8a2 100644 --- a/azure-templates/steps-diff.yml +++ b/azure-templates/steps-diff.yml @@ -10,6 +10,7 @@ steps: displayName: Prepare diff environment inputs: targetType: 'inline' + failOnStdErr: True script: | pip install virtualenv virtualenv env @@ -22,6 +23,7 @@ steps: displayName: Check out NI VS Custom Device Build Tools repository inputs: targetType: 'inline' + failOnStdErr: True script: | git clone https://github.com/ni/niveristand-custom-device-build-tools.git ` $(CD.Repository)\niveristand-custom-device-build-tools @@ -34,6 +36,7 @@ steps: displayName: Diff VIs and publish inputs: targetType: 'inline' + failOnStdErr: True script: | .\env\Scripts\activate cd $(CD.Repository) From 3d6c87c6cb8e4de47629d0b7fe4ee746c6de5712 Mon Sep 17 00:00:00 2001 From: Karl-G1 Date: Thu, 8 Jun 2023 10:30:25 -0500 Subject: [PATCH 2/5] Delete offending file and modify a VI to test diff pipeline errors --- lv/operations/Utilities/ClearCache.vi | Bin 9586 -> 9586 bytes resources/git_utilities.py | 19 ------------------- 2 files changed, 19 deletions(-) delete mode 100644 resources/git_utilities.py diff --git a/lv/operations/Utilities/ClearCache.vi b/lv/operations/Utilities/ClearCache.vi index 019ec13665a8f85ef132804d367b1d179b0cf247..f50528a1685e19784b90c7c8682c0849f8553bd7 100644 GIT binary patch delta 1334 zcmV-61q@V=x6BOD@Nn)a)rVu%}tyC#+uq<(i)TkQ#5mqOM(57356G<)L8&&eM@}N~&b(#!5I3?dD1z|=Bzm)D~774CpI_c<3kOC03 zT@*7N<5w2uG74RFC8Q8D>C!<~wT6_Ee+w-l_0PgJR5$ zbBG~9bT=-{yas>cN6c*{-_0;?h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8)y-!e_|$u84^Tl!z7@|PT1JkD1&?)6k~2& zKnw|@yK!OW6&Qa%V(uvUZiaC)4D!TH9yMI}hWbuHcIatELnOk!G)_#RCQKh-u-)BV zgyCqwZtBpa& zq7llLBoX+UWGeDN#xM_LnB~ExuF6nO#D}j=M5GSXc2$4Obu=!fmu{z*&fd5>e=D7` z=f$Iwaa9ZTEBRBLL81&n5J3Sq9`=u&Kk=~X?DxJfx+TgX9*P$~Q@k;MVwrDQ=8vV2 zD_rK8;5?smo=23Y8F@Mx4>Ftx4~A?~)m-P4yod2{i3b?ZteME7k0o+@dmA}%doqWd8{f1s;ELRRN+a@Eu~Wn zk?V^|yCnY7;lHFN(ipleF{HVQ!MPe@D3~$KEJc5NdT$tJy*lVz0Rpqy%edEx!!Q*(MEjjg=o31;$utgO zn1Uae#$Bey-#Sv`@fvPEs&NrDUN^sh7vCM5ys^6alA70*QuE*syfbm zaGG^+p4LICvJUFegCIn0b#QQSfEmKkRtJB$a<~rO<~I~qUW8r#jY!`Ljn$Obh+Aq@ z9^YC`dFagr?v1r7P5f(mb3|1h=S^i*;tTu^dh>-vlMZOWz{IO+68f#T?L60H9cr>{ z`du`AMaj3}L5-G%C%xO+OB~r2yoX5E7g(Q^1oXmvn+(?1*Aa_j8T-Dfow>`}9+!XF z_5@(1jO8-65e{%rjJZnN9;}c=70d^SS!QjIi?=<9so>c=?s$WEyy=P;E)IS0ZS|NB zSz~^a$Gje2IHR?JIaT9@YeuW0$NZG`n4=XHUi=53Sb%Viy^WJq_@R~tZXIrEoOqe~ zPPnCk&knaV0`fGUa7zOV$YX11M8L4mUU=W zhy1_Dmk{fv9+2k;AT)*9pBWY_@|=AWxr6j)4_$y^bnB9IQGS4n__alPAnhLIelPvi s$z3inWqyS*Y~Q~N%U#F Date: Thu, 8 Jun 2023 10:47:37 -0500 Subject: [PATCH 3/5] Ignore errors on venv creation due to pip warning passed as error --- azure-templates/steps-diff.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-templates/steps-diff.yml b/azure-templates/steps-diff.yml index dc4ac8a2..5cda893e 100644 --- a/azure-templates/steps-diff.yml +++ b/azure-templates/steps-diff.yml @@ -10,7 +10,6 @@ steps: displayName: Prepare diff environment inputs: targetType: 'inline' - failOnStdErr: True script: | pip install virtualenv virtualenv env From 23d769a4b1e99f6a0f1331342a2910965e4e798f Mon Sep 17 00:00:00 2001 From: Karl-G1 Date: Thu, 8 Jun 2023 15:36:42 -0500 Subject: [PATCH 4/5] Only add error to last stage --- azure-templates/steps-diff.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/azure-templates/steps-diff.yml b/azure-templates/steps-diff.yml index 5cda893e..34161b9d 100644 --- a/azure-templates/steps-diff.yml +++ b/azure-templates/steps-diff.yml @@ -22,7 +22,6 @@ steps: displayName: Check out NI VS Custom Device Build Tools repository inputs: targetType: 'inline' - failOnStdErr: True script: | git clone https://github.com/ni/niveristand-custom-device-build-tools.git ` $(CD.Repository)\niveristand-custom-device-build-tools From 244d463614ac7514c4ac57d81eff0404065ef1e1 Mon Sep 17 00:00:00 2001 From: Karl-G1 Date: Thu, 8 Jun 2023 15:41:39 -0500 Subject: [PATCH 5/5] Add back git_utilities.py to test successful diff --- resources/git_utilities.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 resources/git_utilities.py diff --git a/resources/git_utilities.py b/resources/git_utilities.py new file mode 100644 index 00000000..d67a91ff --- /dev/null +++ b/resources/git_utilities.py @@ -0,0 +1,19 @@ +import re +import subprocess + + +def get_changed_files(target_ref): + """ + Get files which have changed compared to the target ref. + + :param target_ref: The git ref to check for changed files against + :return: Tuples of the form (status, filename) where status is either "A" or "M", depending on whether the file was added or modified. + """ + diff_args = ["git", "diff", "--name-status", "--diff-filter=AM", target_ref + "..."] + diff_output = subprocess.check_output(diff_args).decode("utf-8") + + # https://regex101.com/r/EFVDVV/2 + diff_regex = re.compile(r"^([AM])\s+(.*)$", re.MULTILINE) + + for match in re.finditer(diff_regex, diff_output): + yield match.group(1), match.group(2)