Skip to content

gpg: signing failed: Inappropriate ioctl for device #234

@synfinatic

Description

@synfinatic

Support guidelines

I've found a bug and checked that ...

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

Trying to create a clear-sign of all the files in my dist directory after building. Basically generating a signed build of my release pipeline. However, the step in my release process is failing when trying to execute gpg.

Note, that I have also tried adding export GPG_TTY=$(tty) and that also results in failure- although a different error message:

gpg: signing failed: No such file or directory
gpg: [stdin]: clear-sign failed: No such file or directory

Expected behaviour

gpg command executes successfully.

Actual behaviour

$ shasum -a 256 dist/* | gpg --clear-sign > dist/release.sig.asc
gpg: signing failed: Inappropriate ioctl for device
gpg: [stdin]: clear-sign failed: Inappropriate ioctl for device
Error: Process completed with exit code 2.

Steps to reproduce

  1. import the private key
  2. Use gpg to sign some piped output using imported key

Repository URL

https://github.com/synfinatic/netflow2ng

Workflow run URL

https://github.com/synfinatic/netflow2ng/actions/runs/20681124499

YAML workflow

name: Release Binaries

on:
  # Workflow executes when a new release is created
  release:
    types: [created]

jobs:
  # most binaries can be built on linux machine which is the most cost-efficient on GitHub actions
  # for building darwin-arm64 binary we need Xcode, therefore, we need to build it on MacOS

  linux-build:
    name: Linux Binaries
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v6

      - name: Install Go
        uses: actions/setup-go@v6
        with:
          go-version: '${{ vars.GO_VERSION }}'

      - name: Install packages
        run: |
          sudo apt-get update
          sudo apt-get install -y git make rpm libzmq5 libzmq5-dev ruby ruby-dev
          sudo gem install fpm
          sudo mkdir -p /usr/local/
          export PROTOC_VER=30.2
          export PB_REL="https://github.com/protocolbuffers/protobuf/releases"
          curl -LO ${PB_REL}/download/v${PROTOC_VER}/protoc-${PROTOC_VER}-linux-x86_64.zip
          sudo unzip -d /usr/local protoc-${PROTOC_VER}-linux-x86_64.zip

      - name: Run Makefile
        run: |
          go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
          export PATH=/usr/local/bin:$(go env GOPATH)/bin:${PATH}
          echo $PATH
          echo "GoPATH bin contents:"
          ls $(go env GOPATH)/bin
          go version
          make
          make .package-deb
          make .package-rpm

      # Artifacts docs: https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts
      - name: Upload files as artifact
        uses: actions/upload-artifact@v6
        with:
          name: ubuntu-build-files
          path: dist/netflow2ng*
          retention-days: 1

  sign-and-upload-files:
    name: Sign and upload binary files
    runs-on: ubuntu-latest

    # Wait for binary files to be built
    needs: [linux-build]

    steps:
      - name: Download ubuntu binaries
        uses: actions/download-artifact@v7
        with:
          name: ubuntu-build-files
          path: dist/

      - name: Import GPG key
        uses: crazy-max/[email protected]
        with:
          gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
          passphrase: ${{ secrets.GPG_PASSPHRASE }}
          trust_level: 5
          
      - name: List GPG keys
        run: |
          gpg -K

      - name: List files to sign
        run: |
          ls dist/

      - name: Create signature file
        run: |
          shasum -a 256 dist/* | gpg --clear-sign > dist/release.sig.asc

      # Source: https://github.com/svenstaro/upload-release-action
      - name: Upload all files to release
        uses: svenstaro/upload-release-action@v2
        with:
          file: dist/*
          overwrite: true
          file_glob: true

Workflow logs

logs_53459408188.zip

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions