Mender-Artifact cp commands fail on jenkins

Hi,
I’m trying to use mender-artifact cp and cat commands using jenkins. The cat commands work fine but the cp command fails to execute. Here is output from the jenkins machine.

//mender-convert

  • ls
  • bbb-convert-stage-2.sh
  • convert-stage-3.sh
  • convert-stage-4.sh
  • convert-stage-5.sh
  • device-image-shell
  • docker-build
  • docker-entrypoint.sh
  • Dockerfile
  • docker-mender-convert
  • files
  • input
  • LICENSE
  • LIC_FILES_CHKSUM.sha256
  • mender-artifact
  • mender-convert
  • mender-convert-functions.sh
  • output
  • qemux86_64-convert-stage-2.sh
  • README.md
  • rpi-convert-stage-2.sh
  • rpi-convert-stage-5.sh
  • ukey-update-artifact.sh

00:00:00.012 + sudo ./ukey-update-artifact.sh

no artifact or sdimage provided

Contents of ukey-update-artifact.sh

./mender-artifact cat output/.mender:/etc/fstab –> This works
./mender-artifact cp input/mender.conf output/.mender:/etc/fstab –> This fails -ERROR -(no artifact or sdimage provided)
./mender-artifact rm output/:/etc/fstab --> This works

NOTE: When i manually run this script it works perfectly but it fails on jenkins

Hi, we stumbled across this issue ourselves just last week actually. The problem is that the scripts are fed through stdin on the machine, and mender-artifact (faulty), decides to read from stdin, instead of the two files which are listed on the command line.
The PR with the fix can be found here: https://github.com/mendersoftware/mender-artifact/pull/215. Please note that the implementation now (with this PR), requires the use of ‘-’ explicitly, in order to read from stdin.

As a temporary workaround, you can reshape your command to:

./mender-artifact cp output/.mender:/etc/fstab < input/mender.conf

But please note that this workaround won’t work after this is fixed. Normally we don’t change behavior in minor releases, but I think we will make an exception here, due to the very confusing nature of this.

The following error comes after making the changes.
got 1 arguments, wants two

I guess cp command is taking the whole command as one argument.

My command: ./mender-artifact cp ‘output/xyz.mender:/etc/fstab’ < 'input/fstab’

try cat file | mender-artifact cp artifact.mender:/path/in/update

Can you please tell which file should i use with cat. For example I need to copy a file fstab with address input/fstab to the mender artifact in location etc/fstab.

cat input/fstab | mender-artifact cp artifact.mender:/etc/fstab

Thank you soo much the command now works as expected…!!!
The cp command now works and changes the .mender file