Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 arguments required, but only 1 is mandatory in GHA code #103

Open
vakaobr opened this issue May 2, 2023 · 3 comments
Open

2 arguments required, but only 1 is mandatory in GHA code #103

vakaobr opened this issue May 2, 2023 · 3 comments
Labels
bug Something isn't working needs-triage applied to all new customer/user issues. Removed after triage occurs.

Comments

@vakaobr
Copy link

vakaobr commented May 2, 2023

Description

I'm trying to use the apko-publish action, with almost all fields using default values, like:

      - uses: distroless/actions/apko-publish@main
        with:
          # Config is the configuration file to use for the image build.
          # Optional, will use .apko.yaml without a defined one.
          # config: .apko.yaml
          # Tag is the tag that will be published.
          # Required.
          tag: ${{ env.IMAGE_TAG }}
          # Image Refs is the path to a file where apko should emit a newline
          # delimited list of published image digests.
          # Optional, will use a temporary file when unspecified.
          # image_refs: foo.images
          # Enable debug while testing
          debug: true
          generic-user: ${{ env.ACR_USERNAME }}
          generic-pass: ${{ secrets.ACR_PASSWORD }}

From what I can see in the apko-publish/action.yaml file the only required parameter is tag, but when running it, I get the following error:

Error: requires at least 2 arg(s), only received 1
2023/04/26 09:45:07 error during command execution: requires at least 2 arg(s), only received 1

The complete run log shows like this:

Run distroless/actions/apko-publish@main
  with:
    debug: true
    generic-user: <redacted>
    generic-pass: <redacted>
    config: .apko.yaml
    repository_owner: <redacted>
    repository: <redacted>
    token: ***
    image_refs: /tmp/apko.images
    automount-src: /home/runner/work/docker/docker/.apko-automount
    automount-dest: /work
    package-version-tag-stem: false
  env:
    ACR_REGISTRY: <redacted>
    ACR_USERNAME: <redacted>
    DOCKER_DIR: core-openjdk/6.0.0-17-new-relic-8.1.0
    VERSION_NUMBER: 6
    IMAGE_TAGS: <redacted>/core-openjdk:6.0.0-17-new-relic-8.1.0,<redacted>/core-openjdk:6
/usr/bin/docker run --name ghcriowolfidevapkolatest_e54c1c --label 6c044[2](https://github.com/<redacted>/docker/actions/runs/4807250722/jobs/8555772578#step:5:2) --workdir /github/workspace --rm -e "ACR_REGISTRY" -e "ACR_USERNAME" -e "DOCKER_DIR" -e "VERSION_NUMBER" -e "IMAGE_TAGS" -e "INPUT_TAG" -e "INPUT_DEBUG" -e "INPUT_GENERIC-USER" -e "INPUT_GENERIC-PASS" -e "INPUT_CONFIG" -e "INPUT_REPOSITORY_OWNER" -e "INPUT_REPOSITORY" -e "INPUT_TOKEN" -e "INPUT_IMAGE_REFS" -e "INPUT_STAGE_TAGS" -e "INPUT_KEYRING-APPEND" -e "INPUT_REPOSITORY-APPEND" -e "INPUT_ARCHS" -e "INPUT_BUILD-OPTIONS" -e "INPUT_SOURCE-DATE-EPOCH" -e "INPUT_USE-DOCKER-MEDIATYPES" -e "INPUT_AUTOMOUNT-SRC" -e "INPUT_AUTOMOUNT-DEST" -e "INPUT_PACKAGE-VERSION-TAG" -e "INPUT_PACKAGE-VERSION-TAG-STEM" -e "INPUT_PACKAGE-VERSION-TAG-PREFIX" -e "INPUT_TAG-SUFFIX" -e "INPUT_SBOM-PATH" -e "GITHUB_ACTOR" -e "GITHUB_TOKEN" -e "REPOSITORY" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true --entrypoint "/bin/sh" -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/docker/docker":"/github/workspace" ghcr.io/wolfi-dev/apko:latest  "-c" "set -o errexit
set -o pipefail

if [[ \"midocker\" != \"\" && \"***\" != \"\" ]]; then
  echo \"***\" | \
    /usr/bin/apko login -u \"midocker\" \
      --password-stdin \"$(echo \"\" | cut -d'/' -f1)\"
fi

if [ -d \"/home/runner/work/docker/docker/.apko-automount\" ]; then
  echo \"Creating copy of /home/runner/work/docker/docker/.apko-automount at /work\"
  cp -r \"/home/runner/work/docker/docker/.apko-automount\" \"/work\"
fi
[ -n \"\" ] && export SOURCE_DATE_EPOCH=''
[ -n \"\" ] && keys=\"-k \"
[ -n \"\" ] && repos=\"-r \"
[ -n  \"\" ] && archs=\"--arch \"
build_options=\"\"
if [ -n \"\" ]; then
  opts=\"\"
  for opt in ${opts//,/ }; do
    build_options=\"${build_options} --build-option ${opt}\"
  done
fi

packageVersionTag=\"--package-version-tag=\"
if [ \"\" == \"\" ]; then
  repo=$(echo $REPOSITORY | cut -d'/' -f2)
  packageVersionTag=\"--package-version-tag=$repo\"
fi
packageVersionTagPrefix=\"--package-version-tag-prefix=\"

tagSuffix=\"--tag-suffix=\"
sbomPath=\"--sbom-path=\"

export DIGEST_FILE=$(mktemp)
/usr/bin/apko publish \
   \
  --package-version-tag-stem \
  '--debug' \
  --image-refs=\"/tmp/apko.images\" --stage-tags=\"\" .apko.yaml  $keys $repos $archs $build_options $packageVersionTag $packageVersionTagPrefix $tagSuffix $sbomPath | tee ${DIGEST_FILE}
echo EXIT CODE: $?
echo ::set-output name=digest::$(cat ${DIGEST_FILE})
"
202[3](https://github.com/<redacted>/docker/actions/runs/4807250722/jobs/8555772578#step:5:3)/0[4](https://github.com/<redacted>/docker/actions/runs/4807250722/jobs/8555772578#step:5:4)/26 09:4[5](https://github.com/<redacted>/docker/actions/runs/4807250722/jobs/8555772578#step:5:5):07 logged in via /github/home/.docker/config.json
Error: requires at least 2 arg(s), only received 1
2023/04/2[6](https://github.com/<redacted>/docker/actions/runs/4807250722/jobs/8555772578#step:5:6) 09:45:0[7](https://github.com/<redacted>/docker/actions/runs/4807250722/jobs/8555772578#step:5:7) error during command execution: requires at least 2 arg(s), only received 1

Any advice for how I can (try to) debug it further, or any tips of how to use it properly ?

@vakaobr vakaobr added bug Something isn't working needs-triage applied to all new customer/user issues. Removed after triage occurs. labels May 2, 2023
@patflynn
Copy link
Contributor

patflynn commented May 9, 2023

@jdolitsky may know the answer to this.

@patflynn
Copy link
Contributor

patflynn commented May 9, 2023

FYI the actions in this repo are not intended for external users. They may break without notice and we provide no guarantees of support.

@jdolitsky
Copy link
Contributor

i believe your input for tag: is probably incorrect. This input name is probbaly bad on our part, but its not meant to be something like "latest" or "1.2.3", but the full image ref (e.g. ghcr.io/myorg/myrepo:latest)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage applied to all new customer/user issues. Removed after triage occurs.
Projects
None yet
Development

No branches or pull requests

3 participants