cache-apt-pkgs-action icon indicating copy to clipboard operation
cache-apt-pkgs-action copied to clipboard

Another `Packages argument cannot be empty.` when it is not.

Open xavierrigau opened this issue 1 year ago • 3 comments

Seem similar to https://github.com/awalsh128/cache-apt-pkgs-action/issues/116 but that issue has no resolution.

    - name: Apt dependencies
      uses: awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad # v1.4.2
      with:
        packages: libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
        version: 1.4.2
        debug: true

Seem like the normalized list is ok normalized-list libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb

Run awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad
Run ${GITHUB_ACTION_PATH}/pre_cache_action.sh \
+ cache_dir=/home/runner/cache-apt-pkgs
+ version=1.4.2
+ execute_install_scripts=false
+ debug=true
+ input_packages='libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb'
+ log 'Normalizing package list...'
++ date +%T.%3N
+ echo 00:18:03.982 'Normalizing package list...'
00:18:03.982 Normalizing package list...
++ get_normalized_package_list 'libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb'
+++ echo 'libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb'
+++ sed 's/[,\]/ /g; s/\s\+/ /g; s/^\s\+//g; s/\s\+$//g'
+++ sort '-t '
++ local 'packages=libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb'
++++ realpath -- /runner/_work/_actions/awalsh128/cache-apt-pkgs-action/a6c3917cc929dd0345bfb2d3feaf9101823370ad/pre_cache_action.sh
+++ dirname -- /runner/_work/_actions/awalsh128/cache-apt-pkgs-action/a6c3917cc929dd0345bfb2d3feaf9101823370ad/pre_cache_action.sh
++ local script_dir=/runner/_work/_actions/awalsh128/cache-apt-pkgs-action/a6c3917cc929dd0345bfb2d3feaf9101823370ad
+++ dpkg --print-architecture
++ local architecture=amd64
++ '[' amd64 == arm64 ']'
++ /runner/_work/_actions/awalsh128/cache-apt-pkgs-action/a6c3917cc929dd0345bfb2d3feaf9101823370ad/apt_query normalized-list libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
+ packages=
+ log done
++ date +%T.%3N
+ echo 00:18:04.033 done
00:18:04.033 done
+ mkdir -p /home/runner/cache-apt-pkgs
+ log 'Validating action arguments (version='\''1.4.2'\'', packages='\'''\'')...'
++ date +%T.%3N
+ echo 00:18:04.037 'Validating action arguments (version='\''1.4.2'\'', packages='\'''\'')...'
00:18:04.037 Validating action arguments (version='1.4.2', packages='')...
+ grep -q ' '
+ test -z ''
+ log aborted
++ date +%T.%3N
+ echo 00:18:04.040 aborted
00:18:04.040 aborted
+ log 'Packages argument cannot be empty.'
++ date +%T.%3N
+ echo 00:18:04.042 'Packages argument cannot be empty.'
00:18:04.042 Packages argument cannot be empty.
+ exit 3
Error: Process completed with exit code 3.

xavierrigau avatar Aug 30 '24 00:08 xavierrigau

I have the same problem, it doesn't work properly in this OS environment. Debian 12 aarch64

root@orangepi5plus:~# uname -a
Linux orangepi5plus.lan 6.1.43-rockchip-rk3588 #1.0.8 SMP Tue May  7 04:30:57 UTC 2024 aarch64 GNU/Linux

I use this device, Aciton works properly: Debian 12 x86_64

root@hrss:~# uname -a
Linux hrss.lan 6.1.0-21-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.90-1 (2024-05-03) x86_64 GNU/Linux

Both devices use the same deployment method, I use Docker to run Gitea This is my complete yaml file content:

name: Release

on:
  push:
    tags:
      - '*'

jobs:
  build:

    runs-on: ubuntu-latest

    env:
      RUNNER_TOOL_CACHE: /toolcache

    steps:
      - name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: '1.23'
          cache: 'go-build'

      - name: Setup Environment
        uses: actions/setup-node@v3
        with:
          node-version: '16'

      - name: Checkout
        uses: actions/checkout@v4

      - name: Cache APT packages
        uses: awalsh128/cache-apt-pkgs-action@latest
        with:
          packages: zip
          version: 1.0

      - name: Compute hash for Maven pom.xml files
        id: pom-hash
        uses: https://gitea.com/actions/[email protected]
        with:
          patterns: '**/pom.xml'

      - name: Compute hash for Node package-lock.json files
        id: package-lock-hash
        uses: https://gitea.com/actions/[email protected]
        with:
          patterns: '**/package-lock.json'

      - name: Cache Maven packages
        uses: actions/cache@v3
        with:
          path: ~/.m2/repository
          key: ${{ runner.os }}-maven-${{ steps.pom-hash.outputs.hash }}
          restore-keys: |
            ${{ runner.os }}-maven-

      - name: Get npm cache directory
        id: npm-cache-dir
        shell: bash
        run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT

      - name: Cache npm packages
        uses: actions/cache@v3
        with:
          path: ${{ steps.npm-cache-dir.outputs.dir }}
          key: ${{ runner.os }}-node-${{ steps.package-lock-hash.outputs.hash }}
          restore-keys: |
            ${{ runner.os }}-node-

      - name: Setup Maven
        uses: s4u/[email protected]
        with:
          java-version: '21'
          java-distribution: 'temurin'
          maven-version: '3.9.8'
          cache-dir: ~/.m2

      - name: Build with Maven
        run: mvn -B package --file pom.xml

      - name: Build with Node
        run: |
          cp ruoyi-ui/_prod.vue.config.js ruoyi-ui/vue.config.js
          cd ruoyi-ui
          npm install --registry=https://registry.npmmirror.com
          npm run build:prod
          zip -r dist.zip dist
          cd ..

      - name: Copy files
        run: |
          find ruoyi-admin/target -name "*.jar" -print0 | while IFS= read -r -d '' file; do
            cp "$file" "hrss.jar"
          done
          cp ruoyi-admin/src/main/resources/_prod.application.yml application.yml
          cp ruoyi-admin/src/main/resources/_prod.application-druid.yml application-druid.yml
          cp ruoyi-ui/dist.zip .

      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          draft: false
          prerelease: false

      - name: Generate SHA256 hashes
        run: |
          sha256sum hrss.jar > hrss.jar.sha256
          sha256sum application.yml > application.yml.sha256
          sha256sum application-druid.yml > application-druid.yml.sha256
          sha256sum dist.zip > dist.zip.sha256

      - name: Upload Release Asset
        id: upload-release-asset
        uses: https://gitea.com/actions/release-action@main
        with:
          files: |
            hrss.jar
            application.yml
            application-druid.yml
            dist.zip
            hrss.jar.sha256
            application.yml.sha256
            application-druid.yml.sha256
            dist.zip.sha256
          api_key: ${{ secrets.GITHUB_TOKEN }}

xiwangly2 avatar Oct 16 '24 01:10 xiwangly2

I saw an issue recently where virtual packages (aliased) are being passed in and are causing an issue. Can you try running this from a test action and see if any resolve to package that don't include itself?

for pkg in libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb; do
  echo "getting package aliases for $pkg"
  apt-cache pkgnames $pkg
  echo "\n"
done

BTW, I am working on a way to unroll the alias to a concrete package for a future release.

awalsh128 avatar Feb 04 '25 02:02 awalsh128

I was having the same issues, but I'm running this on Gitea actions. Interestingly I'm also using a libasound library. My issues were resolved by doing an apt update before I ran this action. I naively assumed that this library would handle the apt update too.

- name: "Install dependencies (Linux)"
  uses: awalsh128/cache-apt-pkgs-action@latest
  with:
    packages: libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
    version: 1.0

Output:

20:51:00.443 Normalizing package list...
Error encountered running apt-cache --quiet=0 --no-all-versions show libasound2-dev libudev-dev libwayland-dev libxkbcommon-dev
Exited with status code 100; see combined output below:
N: Unable to locate package libasound2-dev
N: Unable to locate package libudev-dev
N: Unable to locate package libwayland-dev
N: Unable to locate package libxkbcommon-dev
N: Unable to locate package libasound2-dev
N: Unable to locate package libudev-dev
N: Unable to locate package libwayland-dev
N: Unable to locate package libxkbcommon-dev
E: No packages found
20:51:00.569 done
20:51:00.581 Validating action arguments (version='1.0', packages='')...
20:51:00.592 aborted
20:51:00.597 Packages argument cannot be empty.

BrainBacon avatar Feb 22 '25 21:02 BrainBacon

Same here, super simple

      - uses: awalsh128/cache-apt-pkgs-action@v1
        with:
          packages: libvips
          version: 1.0
Run ${GITHUB_ACTION_PATH}/pre_cache_action.sh \
  ${GITHUB_ACTION_PATH}/pre_cache_action.sh \
    ~/cache-apt-pkgs \
    "$VERSION" \
    "$EXEC_INSTALL_SCRIPTS" \
    "$DEBUG" \
    "$PACKAGES"
  echo "CACHE_KEY=$(cat ~/cache-apt-pkgs/cache_key.md5)" >> $GITHUB_ENV
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    VERSION: 1
    EXEC_INSTALL_SCRIPTS: false
    DEBUG: false
    PACKAGES: libvips
1[8](https://github.com/ad-spective/platform/actions/runs/13573379010/job/37943692130#step:5:9):31:47.083 Normalizing package list...
18:31:48.[9](https://github.com/ad-spective/platform/actions/runs/13573379010/job/37943692130#step:5:10)78 done
18:31:48.981 Validating action arguments (version='1', packages='')...
18:31:48.983 aborted
18:31:48.985 Packages argument cannot be empty.

thisismydesign avatar Feb 27 '25 18:02 thisismydesign

Thanks @thisismydesign. Could you create a PR for this?

awalsh128 avatar Feb 27 '25 20:02 awalsh128

@awalsh128 A PR? It's a reproduction of the issue

thisismydesign avatar Feb 27 '25 20:02 thisismydesign

Sorry about that @thisismydesign. I should say when it normalizes the package list it will not find virtual packages (which this is). Creating a change for this shortly.

awalsh128 avatar Mar 16 '25 06:03 awalsh128

This is now available in v1.5.0.

awalsh128 avatar Mar 17 '25 21:03 awalsh128

Thank you!

thisismydesign avatar Mar 18 '25 09:03 thisismydesign