Is it possible to get the artifact version in standalone mode?

Hi,

AFAIK, currently, the mender server is checking the artifact version and deciding whether the artifact need to be installed (by checking whether it is already installed on the target platform). Please correct me if I’m wrong.

Since I’m using the mender in standalone mode, I would like to get this feature in the mender client.
Could you please let me know whether this feature can be checked from mender client? Is it possible to get the mender artifact version before downloading/streaming the artifact to the partition?

It’s not possible. The closest thing would be to compile mender-artifact
and use it’s “read” command with some shell parsing to figure out the
name of the artifact.

May I know what mender server doing to get the artifact name? Whether server make use of the same read command?

It uses the mender-artifact parsing library, in particular it calls the
areader.ReadArtifactHeaders() function. The deployment service is using
the same library as the mender client.

1 Like

A colleague pointed out that since the artifacts are tar archives, you can extract the data yourself. Eg.
$ tar xf artifact.mender header.tar.gz -O | tar xz header-info extracts the JSON file containing the artifact name.

Since the artifact format specifies that the metadata is stored near the beginning of the archive, you can fetch only the start of the file, which saves both time and bandwidth.