From 51e1c4b2f8171d66f08573ac57802222f9b0d143 Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Mon, 7 Jul 2025 13:51:39 +0200 Subject: [PATCH 01/29] jdl show --- .github/workflows/_charm-quality-checks.yaml | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index c354cb37..677e88eb 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -292,3 +292,24 @@ jobs: with: timeout-minutes: 30 limit-access-to-actor: true + + - name: Show juju debug-log + run: | + if test -d ./.pytest_jubilant_jdl; then + for filename in ./.pytest_jubilant_jdl/*.txt; do + for ((i=0; i<=3; i++)); do + echo "::group::{{ $filename }}" + cat {{ $filename }} + echo "::endgroup::" + done + done + else + echo "./.pytest_jubilant_jdl not found; ensure you're flying with `pytest-jubilant > 0.7`" + fi + + - name: Upload juju debug-log + uses: actions/upload-artifact@v4 + with: + name: juju-logs + path: ./.pytest_jubilant_jdl + # defaults to 'warn' on failure From ff8b379e25e84e7adb57f7be5f4976212c55d4d8 Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Mon, 7 Jul 2025 13:57:12 +0200 Subject: [PATCH 02/29] lint --- .github/workflows/_charm-quality-checks.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 677e88eb..61b4d0f5 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -296,15 +296,15 @@ jobs: - name: Show juju debug-log run: | if test -d ./.pytest_jubilant_jdl; then - for filename in ./.pytest_jubilant_jdl/*.txt; do + for filename in "./.pytest_jubilant_jdl/*.txt"; do for ((i=0; i<=3; i++)); do echo "::group::{{ $filename }}" - cat {{ $filename }} + cat $filename echo "::endgroup::" done done else - echo "./.pytest_jubilant_jdl not found; ensure you're flying with `pytest-jubilant > 0.7`" + echo "./.pytest_jubilant_jdl not found; ensure you're flying with pytest-jubilant > 0.7" fi - name: Upload juju debug-log From 706ba5af095284bcfe9da90ccf408b7c08e0d430 Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Mon, 7 Jul 2025 14:00:58 +0200 Subject: [PATCH 03/29] lint --- .github/workflows/_charm-quality-checks.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 61b4d0f5..04c6eee2 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -296,10 +296,10 @@ jobs: - name: Show juju debug-log run: | if test -d ./.pytest_jubilant_jdl; then - for filename in "./.pytest_jubilant_jdl/*.txt"; do + for filename in ./.pytest_jubilant_jdl/*.txt; do for ((i=0; i<=3; i++)); do echo "::group::{{ $filename }}" - cat $filename + cat "$filename" echo "::endgroup::" done done From e0bccf96baf99c4dfb4b11b59c9c2bd96eb91997 Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Mon, 7 Jul 2025 15:30:19 +0200 Subject: [PATCH 04/29] replace .pytest_jubilant_jdl with .logs --- .github/workflows/_charm-quality-checks.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 04c6eee2..aa6a6194 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -295,8 +295,8 @@ jobs: - name: Show juju debug-log run: | - if test -d ./.pytest_jubilant_jdl; then - for filename in ./.pytest_jubilant_jdl/*.txt; do + if test -d ./.logs; then + for filename in ./.logs/*.txt; do for ((i=0; i<=3; i++)); do echo "::group::{{ $filename }}" cat "$filename" @@ -304,12 +304,12 @@ jobs: done done else - echo "./.pytest_jubilant_jdl not found; ensure you're flying with pytest-jubilant > 0.7" + echo "./.logs not found; ensure you're flying with pytest-jubilant > 0.7" fi - name: Upload juju debug-log uses: actions/upload-artifact@v4 with: name: juju-logs - path: ./.pytest_jubilant_jdl + path: ./.logs # defaults to 'warn' on failure From 24cad089f2f58cf18cf199bec6f31e89da44dae3 Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Mon, 7 Jul 2025 22:23:47 +0200 Subject: [PATCH 05/29] no references to juju debug-log --- .github/workflows/_charm-quality-checks.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index aa6a6194..21d99303 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -293,7 +293,7 @@ jobs: timeout-minutes: 30 limit-access-to-actor: true - - name: Show juju debug-log + - name: Show logs run: | if test -d ./.logs; then for filename in ./.logs/*.txt; do @@ -307,7 +307,7 @@ jobs: echo "./.logs not found; ensure you're flying with pytest-jubilant > 0.7" fi - - name: Upload juju debug-log + - name: Upload logs uses: actions/upload-artifact@v4 with: name: juju-logs From af600107428b9d58501cd9d4d7efaccfe96a2eaa Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Fri, 11 Jul 2025 08:24:27 +0200 Subject: [PATCH 06/29] pr comments --- .github/workflows/_charm-quality-checks.yaml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 21d99303..9babe1e7 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -295,21 +295,20 @@ jobs: - name: Show logs run: | + cd ${{ inputs.charm-path }} if test -d ./.logs; then for filename in ./.logs/*.txt; do - for ((i=0; i<=3; i++)); do - echo "::group::{{ $filename }}" - cat "$filename" - echo "::endgroup::" - done + echo "::group::{{ $filename }}" + cat "$filename" + echo "::endgroup::" done else - echo "./.logs not found; ensure you're flying with pytest-jubilant > 0.7" + echo "${{ inputs.charm-path }}/.logs not found" fi - name: Upload logs uses: actions/upload-artifact@v4 with: name: juju-logs - path: ./.logs + path: ${{ inputs.charm-path }}/.logs # defaults to 'warn' on failure From c92b376c3cfa295a9435d1273c98666ff6cf485b Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Fri, 11 Jul 2025 15:35:15 +0200 Subject: [PATCH 07/29] echo pwd for debugging --- .github/workflows/_charm-quality-checks.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 9babe1e7..006c8fd1 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -295,6 +295,7 @@ jobs: - name: Show logs run: | + echo pwd cd ${{ inputs.charm-path }} if test -d ./.logs; then for filename in ./.logs/*.txt; do From 0e9cc1776de70c29bb974d0d5f8d561aab30d467 Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Fri, 11 Jul 2025 16:13:52 +0200 Subject: [PATCH 08/29] echo pwd for debugging --- .github/workflows/_charm-quality-checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 006c8fd1..2935242b 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -295,7 +295,7 @@ jobs: - name: Show logs run: | - echo pwd + echo "$(pwd)" cd ${{ inputs.charm-path }} if test -d ./.logs; then for filename in ./.logs/*.txt; do From 157caef2f67b944926f45529c1e72f531a8820a5 Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Mon, 14 Jul 2025 13:24:14 +0200 Subject: [PATCH 09/29] minor lint --- .github/workflows/_charm-quality-checks.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 2935242b..8ee9acb4 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -295,13 +295,15 @@ jobs: - name: Show logs run: | - echo "$(pwd)" cd ${{ inputs.charm-path }} if test -d ./.logs; then for filename in ./.logs/*.txt; do - echo "::group::{{ $filename }}" + # begin collapsible log group for each file found in the folder; + # this is github CI markup + # cfr: https://github.com/go-task/task/issues/647 + printf "\n::group::{{ $filename }}\n" cat "$filename" - echo "::endgroup::" + printf "\n::endgroup::\n" done else echo "${{ inputs.charm-path }}/.logs not found" @@ -311,5 +313,5 @@ jobs: uses: actions/upload-artifact@v4 with: name: juju-logs - path: ${{ inputs.charm-path }}/.logs + path: ${{ inputs.charm-path }}/.logs/ # defaults to 'warn' on failure From 08ba49ba842a30d83b5c2034bb876c9dc6000080 Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Mon, 14 Jul 2025 14:00:25 +0200 Subject: [PATCH 10/29] minor lint --- .github/workflows/_charm-quality-checks.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 8ee9acb4..c616a90d 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -301,7 +301,7 @@ jobs: # begin collapsible log group for each file found in the folder; # this is github CI markup # cfr: https://github.com/go-task/task/issues/647 - printf "\n::group::{{ $filename }}\n" + printf "\n::group:: $filename\n" cat "$filename" printf "\n::endgroup::\n" done @@ -311,7 +311,11 @@ jobs: - name: Upload logs uses: actions/upload-artifact@v4 + + # defaults to 'warn' on failure with: - name: juju-logs - path: ${{ inputs.charm-path }}/.logs/ - # defaults to 'warn' on failure + name: logs + path: | + {{ inputs.charm-path }}/.logs/ + {{ inputs.charm-path }}/.logs/logfile.txt + # FIXME:remove this From ed42b551580337c535bd77801406b4f7c7136a7e Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Mon, 14 Jul 2025 14:08:06 +0200 Subject: [PATCH 11/29] printf lint --- .github/workflows/_charm-quality-checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index c616a90d..9c6f71ef 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -301,7 +301,7 @@ jobs: # begin collapsible log group for each file found in the folder; # this is github CI markup # cfr: https://github.com/go-task/task/issues/647 - printf "\n::group:: $filename\n" + printf '\n::group:: %s\n' "$filename" cat "$filename" printf "\n::endgroup::\n" done From 19f2c953f492116d276a85aae5fd6a243b5819dc Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Mon, 14 Jul 2025 14:11:34 +0200 Subject: [PATCH 12/29] dollars --- .github/workflows/_charm-quality-checks.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 9c6f71ef..97fb8d68 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -316,6 +316,6 @@ jobs: with: name: logs path: | - {{ inputs.charm-path }}/.logs/ - {{ inputs.charm-path }}/.logs/logfile.txt + ${{ inputs.charm-path }}/.logs/ + ${{ inputs.charm-path }}/.logs/logfile.txt # FIXME:remove this From 07e6f650b50da817c1ee5656f958126627bf59bb Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Mon, 14 Jul 2025 14:23:20 +0200 Subject: [PATCH 13/29] .logs without prefix --- .github/workflows/_charm-quality-checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 97fb8d68..5f4df4a5 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -316,6 +316,6 @@ jobs: with: name: logs path: | + .logs/ ${{ inputs.charm-path }}/.logs/ - ${{ inputs.charm-path }}/.logs/logfile.txt # FIXME:remove this From d4eabcfe53f07929ba341dd50b2182d354c441b0 Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Mon, 14 Jul 2025 15:37:27 +0200 Subject: [PATCH 14/29] .logs without prefix --- .github/workflows/_charm-quality-checks.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 5f4df4a5..5b60c4c5 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -315,7 +315,4 @@ jobs: # defaults to 'warn' on failure with: name: logs - path: | - .logs/ - ${{ inputs.charm-path }}/.logs/ - # FIXME:remove this + path: .logs/ From c4d473cf313c062a15670a362e1ee65df1d49b1c Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Mon, 21 Jul 2025 11:57:42 +0200 Subject: [PATCH 15/29] include hidden files --- .github/workflows/_charm-quality-checks.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 5b60c4c5..be0178f5 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -315,4 +315,5 @@ jobs: # defaults to 'warn' on failure with: name: logs + include-hidden-files: true path: .logs/ From 3efe189e3e5f6a73ab0801ec98f0452f597e7b2f Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Mon, 21 Jul 2025 12:10:37 +0200 Subject: [PATCH 16/29] unique names and lifted path to var --- .github/workflows/_charm-quality-checks.yaml | 20 ++++++++++++-------- .github/workflows/charm-pull-request.yaml | 8 ++++++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index be0178f5..989b078b 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -7,6 +7,13 @@ on: type: string required: false default: . + log-path: + type: string + description: | + Path to a directory where the logs for an integration testing run will be stored. + Is always interpreted relative to the charm root. + required: false + default: .logs provider: type: string description: "The provider to choose for integration tests ('machine' or 'microk8s')" @@ -292,12 +299,11 @@ jobs: with: timeout-minutes: 30 limit-access-to-actor: true - - name: Show logs run: | cd ${{ inputs.charm-path }} - if test -d ./.logs; then - for filename in ./.logs/*.txt; do + if test -d ./${{ inputs.log-path }}; then + for filename in ./${{ inputs.log-path }}/*.txt; do # begin collapsible log group for each file found in the folder; # this is github CI markup # cfr: https://github.com/go-task/task/issues/647 @@ -306,14 +312,12 @@ jobs: printf "\n::endgroup::\n" done else - echo "${{ inputs.charm-path }}/.logs not found" + echo "${{ inputs.charm-path }}/${{ inputs.log-path }} not found" fi - - name: Upload logs uses: actions/upload-artifact@v4 - # defaults to 'warn' on failure with: - name: logs + name: charm-logs${{ (inputs.charm-path && inputs.charm-path != '.') && format('-{0}', inputs.charm-path) || '' }} include-hidden-files: true - path: .logs/ + path: ${{ inputs.log-path }} \ No newline at end of file diff --git a/.github/workflows/charm-pull-request.yaml b/.github/workflows/charm-pull-request.yaml index 2552efc7..540c2712 100644 --- a/.github/workflows/charm-pull-request.yaml +++ b/.github/workflows/charm-pull-request.yaml @@ -8,6 +8,13 @@ on: default: '.' required: false type: string + log-path: + type: string + description: | + Path to a directory where the logs for an integration testing run will be stored. + Is always interpreted relative to the charm root. + required: false + default: .logs provider: description: "The provider to choose for either machine or k8s tests ('machine' or 'microk8s')" default: 'microk8s' @@ -118,6 +125,7 @@ jobs: secrets: inherit with: charm-path: ${{ inputs.charm-path }} + log-path: ${{ inputs.log-path }} provider: ${{ inputs.provider }} charmcraft-channel: ${{ inputs.charmcraft-channel }} juju-channel: ${{ inputs.juju-channel }} From 0f42f3ac48ac417b0d4f481f78028207d8e96d1e Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Mon, 21 Jul 2025 12:31:03 +0200 Subject: [PATCH 17/29] added abspath support --- .github/workflows/_charm-quality-checks.yaml | 22 +++++++++++++------- .github/workflows/charm-pull-request.yaml | 7 +++++-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 989b078b..785909ab 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -10,8 +10,11 @@ on: log-path: type: string description: | - Path to a directory where the logs for an integration testing run will be stored. - Is always interpreted relative to the charm root. + Path to a directory where the .txt logfiles for an integration testing run will be stored. + Relative and absolute file paths are both allowed. + Relative paths are rooted against the charm repository root. + Paths that begin with a wildcard character should be quoted to avoid being + interpreted as YAML aliases. required: false default: .logs provider: @@ -299,11 +302,16 @@ jobs: with: timeout-minutes: 30 limit-access-to-actor: true + - name: Determine log files location + id: log_path_det + run: | + # if the user gave us a relative path, interpret it from the charm-path root. + log_path=[[ "${{ inputs.log-path }}" =~ ^/ ]] && "${{ inputs.log-path }}" || "${{ inputs.charm-path }}/${{ inputs.log-path }}" + echo "log_path=$log_path" >> "$GITHUB_OUTPUT" - name: Show logs run: | - cd ${{ inputs.charm-path }} - if test -d ./${{ inputs.log-path }}; then - for filename in ./${{ inputs.log-path }}/*.txt; do + if test -d ${{ steps.log_path_det.outputs.log_path }}; then + for filename in ${{ steps.log_path_det.outputs.log_path }}/*.txt; do # begin collapsible log group for each file found in the folder; # this is github CI markup # cfr: https://github.com/go-task/task/issues/647 @@ -312,7 +320,7 @@ jobs: printf "\n::endgroup::\n" done else - echo "${{ inputs.charm-path }}/${{ inputs.log-path }} not found" + echo "${{ steps.log_path_det.outputs.log_path }} not found" fi - name: Upload logs uses: actions/upload-artifact@v4 @@ -320,4 +328,4 @@ jobs: with: name: charm-logs${{ (inputs.charm-path && inputs.charm-path != '.') && format('-{0}', inputs.charm-path) || '' }} include-hidden-files: true - path: ${{ inputs.log-path }} \ No newline at end of file + path: ${{ steps.log_path_det.outputs.log_path }} \ No newline at end of file diff --git a/.github/workflows/charm-pull-request.yaml b/.github/workflows/charm-pull-request.yaml index 540c2712..0eca5bcd 100644 --- a/.github/workflows/charm-pull-request.yaml +++ b/.github/workflows/charm-pull-request.yaml @@ -11,8 +11,11 @@ on: log-path: type: string description: | - Path to a directory where the logs for an integration testing run will be stored. - Is always interpreted relative to the charm root. + Path to a directory where the .txt logfiles for an integration testing run will be stored. + Relative and absolute file paths are both allowed. + Relative paths are rooted against the charm repository root. + Paths that begin with a wildcard character should be quoted to avoid being + interpreted as YAML aliases. required: false default: .logs provider: From 757388499a0693dfa5622c0a45ddee0a88e044db Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Tue, 22 Jul 2025 12:12:38 +0200 Subject: [PATCH 18/29] echo the path --- .github/workflows/_charm-quality-checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 785909ab..535d0e43 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -306,7 +306,7 @@ jobs: id: log_path_det run: | # if the user gave us a relative path, interpret it from the charm-path root. - log_path=[[ "${{ inputs.log-path }}" =~ ^/ ]] && "${{ inputs.log-path }}" || "${{ inputs.charm-path }}/${{ inputs.log-path }}" + log_path=[[ "${{ inputs.log-path }}" =~ ^/ ]] && echo "${{ inputs.log-path }}" || echo "${{ inputs.charm-path }}/${{ inputs.log-path }}" echo "log_path=$log_path" >> "$GITHUB_OUTPUT" - name: Show logs run: | From 3941a91fa53e57509f2ede74b78477d08c27ae96 Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Wed, 23 Jul 2025 09:05:33 +0200 Subject: [PATCH 19/29] reecho the path --- .github/workflows/_charm-quality-checks.yaml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 535d0e43..defacb35 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -303,15 +303,17 @@ jobs: timeout-minutes: 30 limit-access-to-actor: true - name: Determine log files location - id: log_path_det + id: get_log_path run: | # if the user gave us a relative path, interpret it from the charm-path root. + # if path starts with / it's absolute, else it's relative, and we prepend the (absolute) charm-path to it log_path=[[ "${{ inputs.log-path }}" =~ ^/ ]] && echo "${{ inputs.log-path }}" || echo "${{ inputs.charm-path }}/${{ inputs.log-path }}" + echo "log path is: $log_path" echo "log_path=$log_path" >> "$GITHUB_OUTPUT" - name: Show logs run: | - if test -d ${{ steps.log_path_det.outputs.log_path }}; then - for filename in ${{ steps.log_path_det.outputs.log_path }}/*.txt; do + if test -d "${{ steps.get_log_path.outputs.log_path }}"; then + for filename in ${{ steps.get_log_path.outputs.log_path }}/*.txt; do # begin collapsible log group for each file found in the folder; # this is github CI markup # cfr: https://github.com/go-task/task/issues/647 @@ -320,7 +322,7 @@ jobs: printf "\n::endgroup::\n" done else - echo "${{ steps.log_path_det.outputs.log_path }} not found" + echo "${{ steps.get_log_path.outputs.log_path }} not found" fi - name: Upload logs uses: actions/upload-artifact@v4 @@ -328,4 +330,4 @@ jobs: with: name: charm-logs${{ (inputs.charm-path && inputs.charm-path != '.') && format('-{0}', inputs.charm-path) || '' }} include-hidden-files: true - path: ${{ steps.log_path_det.outputs.log_path }} \ No newline at end of file + path: ${{ steps.get_log_path.outputs.log_path }} \ No newline at end of file From 1e584ba3f3c5819a641f7d19cdc0bfe769c4eba2 Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Wed, 23 Jul 2025 09:16:35 +0200 Subject: [PATCH 20/29] wrap log path in expression --- .github/workflows/_charm-quality-checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index defacb35..d350f75b 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -307,7 +307,7 @@ jobs: run: | # if the user gave us a relative path, interpret it from the charm-path root. # if path starts with / it's absolute, else it's relative, and we prepend the (absolute) charm-path to it - log_path=[[ "${{ inputs.log-path }}" =~ ^/ ]] && echo "${{ inputs.log-path }}" || echo "${{ inputs.charm-path }}/${{ inputs.log-path }}" + log_path="$([[ "${{ inputs.log-path }}" = /* ]] && echo "${{ inputs.log-path }}" || echo "${{ inputs.charm-path }}/${{ inputs.log-path }}")" echo "log path is: $log_path" echo "log_path=$log_path" >> "$GITHUB_OUTPUT" - name: Show logs From 1af4b038975f9034679cbd2a4fa042b04c574c96 Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Wed, 23 Jul 2025 09:31:24 +0200 Subject: [PATCH 21/29] add matrix suite to log upload file name --- .github/workflows/_charm-quality-checks.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index d350f75b..26d37a9c 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -328,6 +328,7 @@ jobs: uses: actions/upload-artifact@v4 # defaults to 'warn' on failure with: - name: charm-logs${{ (inputs.charm-path && inputs.charm-path != '.') && format('-{0}', inputs.charm-path) || '' }} + name: charm-logs${{ (inputs.charm-path && inputs.charm-path != '.') && format('-{0}', inputs.charm-path) || '' }}-${{ matrix.suite }} include-hidden-files: true + # we assume that log_path is never going to be an empty string; but it may well be a non-existing directory. path: ${{ steps.get_log_path.outputs.log_path }} \ No newline at end of file From ee57f074ac20797ca89d958179a628646df7d44b Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Tue, 26 Aug 2025 08:15:46 +0200 Subject: [PATCH 22/29] graph update --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index fae655c8..4bafa7ff 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,8 @@ block-beta qualitychecksslow["Quality Checks (integration)"] pack["Pack the charm"] integration["Integration tests"] + displaylogs["Display logs"] + uploadlogs["Upload logs zipfile"] end From 07b48406802c9d35e0ffc7cfd2cc774fcd97760d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Apr 2026 12:05:42 +0000 Subject: [PATCH 23/29] fix: use case statement to avoid shellcheck SC2193 in log path detection Agent-Logs-Url: https://github.com/canonical/observability/sessions/f549ed24-695e-4774-81db-5a5c87f2f1a5 Co-authored-by: lucabello <36242061+lucabello@users.noreply.github.com> --- .github/workflows/_charm-quality-checks.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 431cc397..4e63bbaf 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -418,7 +418,10 @@ jobs: run: | # if the user gave us a relative path, interpret it from the charm-path root. # if path starts with / it's absolute, else it's relative, and we prepend the (absolute) charm-path to it - log_path="$([[ "${{ inputs.log-path }}" = /* ]] && echo "${{ inputs.log-path }}" || echo "${{ inputs.charm-path }}/${{ inputs.log-path }}")" + case "${{ inputs.log-path }}" in + /*) log_path="${{ inputs.log-path }}" ;; + *) log_path="${{ inputs.charm-path }}/${{ inputs.log-path }}" ;; + esac echo "log path is: $log_path" echo "log_path=$log_path" >> "$GITHUB_OUTPUT" - name: Show logs From ed94e2f00bc9df6c428d46d03b184edc23935f79 Mon Sep 17 00:00:00 2001 From: Luca Bello <36242061+lucabello@users.noreply.github.com> Date: Thu, 30 Apr 2026 12:32:54 +0200 Subject: [PATCH 24/29] Update .github/workflows/_charm-quality-checks.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Luca Bello <36242061+lucabello@users.noreply.github.com> --- .github/workflows/_charm-quality-checks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 4e63bbaf..fd3fcd37 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -10,7 +10,7 @@ on: log-path: type: string description: | - Path to a directory where the .txt logfiles for an integration testing run will be stored. + Path to a directory where the .txt log files for an integration testing run will be stored. Relative and absolute file paths are both allowed. Relative paths are rooted against the charm repository root. Paths that begin with a wildcard character should be quoted to avoid being From 1d143c899ae97d0cb4a3df3cf8514afd620db360 Mon Sep 17 00:00:00 2001 From: Luca Bello <36242061+lucabello@users.noreply.github.com> Date: Thu, 30 Apr 2026 12:33:07 +0200 Subject: [PATCH 25/29] Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Luca Bello <36242061+lucabello@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4bafa7ff..859e1d6c 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ block-beta pack["Pack the charm"] integration["Integration tests"] displaylogs["Display logs"] - uploadlogs["Upload logs zipfile"] + uploadlogs["Upload logs zip file"] end From 652dda772699b5f421925b3596ebac535962f4c8 Mon Sep 17 00:00:00 2001 From: Luca Bello <36242061+lucabello@users.noreply.github.com> Date: Thu, 30 Apr 2026 12:33:20 +0200 Subject: [PATCH 26/29] Update .github/workflows/charm-pull-request.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Luca Bello <36242061+lucabello@users.noreply.github.com> --- .github/workflows/charm-pull-request.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/charm-pull-request.yaml b/.github/workflows/charm-pull-request.yaml index ed72b7fa..9de6e25a 100644 --- a/.github/workflows/charm-pull-request.yaml +++ b/.github/workflows/charm-pull-request.yaml @@ -13,7 +13,7 @@ on: description: | Path to a directory where the .txt logfiles for an integration testing run will be stored. Relative and absolute file paths are both allowed. - Relative paths are rooted against the charm repository root. + Relative paths are resolved relative to `charm-path`. Paths that begin with a wildcard character should be quoted to avoid being interpreted as YAML aliases. required: false From 1cdc18bdc992ae88433fc960b62ded09afa10e99 Mon Sep 17 00:00:00 2001 From: Luca Bello <36242061+lucabello@users.noreply.github.com> Date: Thu, 30 Apr 2026 12:33:51 +0200 Subject: [PATCH 27/29] Update .github/workflows/charm-pull-request.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Luca Bello <36242061+lucabello@users.noreply.github.com> --- .github/workflows/charm-pull-request.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/charm-pull-request.yaml b/.github/workflows/charm-pull-request.yaml index 9de6e25a..731951f5 100644 --- a/.github/workflows/charm-pull-request.yaml +++ b/.github/workflows/charm-pull-request.yaml @@ -11,7 +11,7 @@ on: log-path: type: string description: | - Path to a directory where the .txt logfiles for an integration testing run will be stored. + Path to a directory where the .txt log files for an integration testing run will be stored. Relative and absolute file paths are both allowed. Relative paths are resolved relative to `charm-path`. Paths that begin with a wildcard character should be quoted to avoid being From 97192535049457d6a55ad9158a244ea22f49dd80 Mon Sep 17 00:00:00 2001 From: Luca Bello <36242061+lucabello@users.noreply.github.com> Date: Thu, 30 Apr 2026 12:34:20 +0200 Subject: [PATCH 28/29] Update .github/workflows/_charm-quality-checks.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Luca Bello <36242061+lucabello@users.noreply.github.com> --- .github/workflows/_charm-quality-checks.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index fd3fcd37..77c349eb 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -11,9 +11,10 @@ on: type: string description: | Path to a directory where the .txt log files for an integration testing run will be stored. - Relative and absolute file paths are both allowed. - Relative paths are rooted against the charm repository root. - Paths that begin with a wildcard character should be quoted to avoid being + Relative and absolute file paths are both allowed. + Relative paths are rooted against the charm directory specified by `charm-path` + (which defaults to the repository root, `.`). + Paths that begin with a wildcard character should be quoted to avoid being interpreted as YAML aliases. required: false default: .logs From f06d6e67d0e91f6729271f7ed2c185106cb2334e Mon Sep 17 00:00:00 2001 From: Luca Bello Date: Thu, 30 Apr 2026 12:37:16 +0200 Subject: [PATCH 29/29] fix: address PR review comments for log handling - Security: pass inputs via env vars instead of direct interpolation in run scripts to prevent script injection - Add log display and upload steps to sequential integration job (integration-mono) for consistent behavior across modes - Add 'if: always()' to log steps so they run even on test failure - Add 'shopt -s nullglob' to handle empty glob when no .txt files exist - Connect displaylogs/uploadlogs nodes in Mermaid diagram Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/_charm-quality-checks.yaml | 64 +++++++++++++++++--- README.md | 2 +- 2 files changed, 56 insertions(+), 10 deletions(-) diff --git a/.github/workflows/_charm-quality-checks.yaml b/.github/workflows/_charm-quality-checks.yaml index 77c349eb..41f8c843 100644 --- a/.github/workflows/_charm-quality-checks.yaml +++ b/.github/workflows/_charm-quality-checks.yaml @@ -284,6 +284,43 @@ jobs: CHARM_PATH="$(realpath "$charm_relative_path")" export CHARM_PATH uvx tox -e integration + - name: Determine log files location + if: always() + id: get_log_path + env: + LOG_PATH: ${{ inputs.log-path }} + CHARM_PATH: ${{ inputs.charm-path }} + run: | + # if the user gave us a relative path, interpret it from the charm-path root. + # if path starts with / it's absolute, else it's relative, and we prepend the (absolute) charm-path to it + case "$LOG_PATH" in + /*) log_path="$LOG_PATH" ;; + *) log_path="$CHARM_PATH/$LOG_PATH" ;; + esac + echo "log path is: $log_path" + echo "log_path=$log_path" >> "$GITHUB_OUTPUT" + - name: Show logs + if: always() + env: + LOG_DIR: ${{ steps.get_log_path.outputs.log_path }} + run: | + if test -d "$LOG_DIR"; then + shopt -s nullglob + for filename in "$LOG_DIR"/*.txt; do + printf '\n::group:: %s\n' "$filename" + cat "$filename" + printf "\n::endgroup::\n" + done + else + echo "$LOG_DIR not found" + fi + - name: Upload logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: charm-logs${{ (inputs.charm-path && inputs.charm-path != '.') && format('-{0}', inputs.charm-path) || '' }} + include-hidden-files: true + path: ${{ steps.get_log_path.outputs.log_path }} integration-matrix: name: Define Integration tests matrix @@ -415,21 +452,29 @@ jobs: timeout-minutes: 30 limit-access-to-actor: true - name: Determine log files location + if: always() id: get_log_path + env: + LOG_PATH: ${{ inputs.log-path }} + CHARM_PATH: ${{ inputs.charm-path }} run: | # if the user gave us a relative path, interpret it from the charm-path root. # if path starts with / it's absolute, else it's relative, and we prepend the (absolute) charm-path to it - case "${{ inputs.log-path }}" in - /*) log_path="${{ inputs.log-path }}" ;; - *) log_path="${{ inputs.charm-path }}/${{ inputs.log-path }}" ;; + case "$LOG_PATH" in + /*) log_path="$LOG_PATH" ;; + *) log_path="$CHARM_PATH/$LOG_PATH" ;; esac echo "log path is: $log_path" echo "log_path=$log_path" >> "$GITHUB_OUTPUT" - name: Show logs - run: | - if test -d "${{ steps.get_log_path.outputs.log_path }}"; then - for filename in ${{ steps.get_log_path.outputs.log_path }}/*.txt; do - # begin collapsible log group for each file found in the folder; + if: always() + env: + LOG_DIR: ${{ steps.get_log_path.outputs.log_path }} + run: | + if test -d "$LOG_DIR"; then + shopt -s nullglob + for filename in "$LOG_DIR"/*.txt; do + # begin collapsible log group for each file found in the folder; # this is github CI markup # cfr: https://github.com/go-task/task/issues/647 printf '\n::group:: %s\n' "$filename" @@ -437,13 +482,14 @@ jobs: printf "\n::endgroup::\n" done else - echo "${{ steps.get_log_path.outputs.log_path }} not found" + echo "$LOG_DIR not found" fi - name: Upload logs + if: always() uses: actions/upload-artifact@v4 # defaults to 'warn' on failure with: name: charm-logs${{ (inputs.charm-path && inputs.charm-path != '.') && format('-{0}', inputs.charm-path) || '' }}-${{ matrix.suite }} include-hidden-files: true # we assume that log_path is never going to be an empty string; but it may well be a non-existing directory. - path: ${{ steps.get_log_path.outputs.log_path }} \ No newline at end of file + path: ${{ steps.get_log_path.outputs.log_path }} diff --git a/README.md b/README.md index 859e1d6c..4da78ee6 100644 --- a/README.md +++ b/README.md @@ -62,9 +62,9 @@ block-beta integration["Integration tests"] displaylogs["Display logs"] uploadlogs["Upload logs zip file"] + integration --> displaylogs --> uploadlogs end - block columns 1 release["Release Charm (per arch)"]