awalsh128 / cache-apt-pkgs-action

Cache APT packages in GitHub Actions
Other
205 stars 35 forks source link

Error with multiline packages using black scalar styles `>` and `|` in YAML. #84

Closed einverne closed 1 year ago

einverne commented 1 year ago
      - name: Install dependencies for Ubuntu
        if: matrix.os == 'ubuntu-latest'
        uses: awalsh128/cache-apt-pkgs-action@latest
        with:
          packages: >
            libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev
            libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
          version: 1.0

Error log:

For more detailed logs during the artifact upload process, enable step-debugging: https://docs.github.com/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging#enabling-step-debug-logging
Error: Artifact name is not valid: cache-apt-pkgs-logs%libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
%1. Contains the following character:  Line feed \n

Invalid characters include:  Double quote ", Colon :, Less than <, Greater than >, Vertical bar |, Asterisk *, Question mark ?, Carriage return \r, Line feed \n, Backslash \, Forward slash /

These characters are not allowed in the artifact name due to limitations with certain file systems such as NTFS. To maintain file system agnostic behavior, these characters are intentionally not allowed to prevent potential problems with downloads on different file systems.

Version: 1.2.2 lastest

GitHub Actions can use the Folded Block Scalar syntax. But It seems failed in the latest version.

Stas-AbsoluteDesign commented 1 year ago

The same happens when you do a multiline split. The line is 494 characters long, so ofc you want it to look nicer and split to a multiline one. So it actually runs installation OK but fails on the very last step of caching.

  uses: awalsh128/cache-apt-pkgs-action@latest
  with:
    packages: |
      wget unzip fontconfig locales gconf-service libasound2 libatk1.0-0 libc6 libcairo2 \
      libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgconf-2-4 libgdk-pixbuf2.0-0 libstdc++6 \
      libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libappindicator1 \
      libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 \
      libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libatk-bridge2.0-0 \
      libx11-6 libnss3 lsb-release xdg-utils
    version: 1.0

Result:

23:21:10 Clean installing 41 packages...
23:21:12 done
23:21:12 Installation log written to /home/runner/cache-apt-pkgs/install.log

23:21:12 Installed package list:

23:21:12 Caching 0 installed packages...
23:21:12 done (total cache size 16K)

23:21:12 Skipped all manifest write. No packages to install.

cat: /home/runner/cache-apt-pkgs/manifest_all.log: No such file or directory
/home/runner/actions-runner/_work/_temp/af04a2e5-5d86-4f61-91ed-5f1af2a786e4.sh: line 14: -1: substring expression < 0
Run actions/upload-artifact@v3
With the provided path, there will be 2 files uploaded
Starting artifact upload
For more detailed logs during the artifact upload process, enable step-debugging: https://docs.github.com/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging#enabling-step-debug-logging
Error: Artifact name is not valid: cache-apt-pkgs-logs%wget unzip fontconfig locales gconf-service libasound2 libatk1.0-0 libc6 libcairo2 \
libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgconf-2-4 libgdk-pixbuf2.0-0 libstdc++6 \
libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libappindicator1 \
libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 \
libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libatk-bridge2.0-0 \
libx11-6 libnss3 lsb-release xdg-utils
%1. Contains the following character:  Line feed \n

Invalid characters include:  Double quote ", Colon :, Less than <, Greater than >, Vertical bar |, Asterisk *, Question mark ?, Carriage return \r, Line feed \n, Backslash \, Forward slash /

These characters are not allowed in the artifact name due to limitations with certain file systems such as NTFS. To maintain file system agnostic behavior, these characters are intentionally not allowed to prevent potential problems with downloads on different file systems.

Full log: https://pastebin.com/B5m9phrk

awalsh128 commented 1 year ago

Sorry for the lag here. I'll add a regression for it and address this. Shouldn't be too hard.

awalsh128 commented 1 year ago

Regressions added on CI.

https://github.com/awalsh128/cache-apt-pkgs-action-ci/commit/7f6a191755f169015a585abfd8c08c260884f48b

awalsh128 commented 1 year ago

@panzi it looks like backslashes get retained in the block scalar literal style. Your suggestions did fix the previous issue so we are making progress.

https://github.com/awalsh128/cache-apt-pkgs-action-ci/actions/runs/4090270692/jobs/7053564102

I could strip these but it would seem more intuitive that these get omitted since it is part of the YAML syntax and is not a literal. In any case, going to do some more digging and try to find an elegant solution.

awalsh128 commented 1 year ago

Regressions are passing now.

https://github.com/awalsh128/cache-apt-pkgs-action-ci/actions/runs/4098253383

Going to cut a release and close this out v1.2.4.

awalsh128 commented 1 year ago

All set https://github.com/awalsh128/cache-apt-pkgs-action/releases/tag/v1.2.4

Stas-AbsoluteDesign commented 1 year ago

Thank you @awalsh128 🥇