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.
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
Hii everyone I am facing another issue. While I copy the files with the above-mentioned solution; I am getting permission issue with my files. I m modifying the mender-device-identity file with Jenkins and copying it inside the .mender file.
Original mender-device-identity permissions : -rwxr-xr-x
After deploying mender update to a Raspberry Pi3: -rw-----
I tried changing the permission using the commamd:
./mender-artifact install -m 777 input/mender-device-identity $file.mender:/usr/share/mender/identity/mender-device-identity
But it came up with the same error as it was throwing in cp command
No artifact or sdimg provided
Hi @Shrulabh, I don’t see anything wrong with your command at first sight.
Have you tried this command locally?
And are you sure that
$file resolves to a filename, without the
Hii @oleorhagen yes the $file resolves a filename and the command works locally. But the issue is that it fails in Jenkins build; with the error No artifact or sdimg provided
Could you show me what
$file resolves to?
./mender-artifact install -m 777 input/mender-device-identity output/ras_modify.mender:/usr/share/mender/identity/mender-device-identity
This is the final command that runs in jenkins
Hmm, curious, I don’t see anything wrong with it on the surface. Could you send me the artifact in question ?
Also which version of mender-artifact are you using?
I’m using the prebuilt mender artifact that is mentioned in the documentation of mender.
https://d1b0l86ne08fsf.cloudfront.net/mender-artifact/3.0.1/mender-artifact this is the link