# Howto: MENDER\_ARTIFACT\_NAME automatic setup for yocto build

**URL:** https://hub.mender.io/t/howto-mender-artifact-name-automatic-setup-for-yocto-build/468
**Category:** General Discussions
**Created:** [April 10, 2019, 7:13am UTC](https://hub.mender.io/t/howto-mender-artifact-name-automatic-setup-for-yocto-build/468 "2019-04-10T07:13:44Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![MarekBelisko](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/marekbelisko/32/33_2.png) [@MarekBelisko](https://hub.mender.io/u/MarekBelisko)
#### Post date: [April 10, 2019, 7:13am UTC](https://hub.mender.io/t/howto-mender-artifact-name-automatic-setup-for-yocto-build/468/1 "2019-04-10T07:13:44Z")

</div>

There was already discussion about setting automatics ARTIFACT\_NAME in old google forum just want to share how I did it (maybe someone will find it handy).

Basically I’ve setup in local.conf

```auto
MENDER_ARTIFACT_NAME ?= "release-1"

```

this variable have weak preference so our set with environment will be used (if we don’t use one in env default release-1 will be used).  
Then in build script I set:

```auto
export MENDER_ARTIFACT_NAME="$version"
export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE MENDER_ARTIFACT_NAME"

```

where $version is desired version (we use it from runner like date\_time\_machine…)

finally build then image like usual and mender artifact will have then version used in MENDER\_ARTIFACT\_NAME variable. Comments? Thanks.

---

<div class="post-metadata">

### Author: ![andersm](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/andersm/32/797_2.png) [@andersm](https://hub.mender.io/u/andersm)
#### Post date: [July 29, 2019, 10:14am UTC](https://hub.mender.io/t/howto-mender-artifact-name-automatic-setup-for-yocto-build/468/2 "2019-07-29T10:14:21Z")

</div>

Hi,

I’m looking at the same problem, ie. injecting the artifact name from the CI. The drawback of using external environment variables is that it causes Bitbake to re-parse everything, which is pretty slow.

I was considering just using mender-artifact to set the artifact name as a post-build step, but unfortunately it can’t (AFAIK) manipulate the sdimg image files produced by Bitbake.

---

<div class="post-metadata">

### Author: ![MarekBelisko](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/marekbelisko/32/33_2.png) [@MarekBelisko](https://hub.mender.io/u/MarekBelisko)
#### Post date: [July 29, 2019, 10:20am UTC](https://hub.mender.io/t/howto-mender-artifact-name-automatic-setup-for-yocto-build/468/3 "2019-07-29T10:20:13Z")

</div>

@andersm welcome. Well it’s kind of true only when variable is changed. I’m not aware of any easy way of manipulating artifact name only by updating variable (would be possible though by some special way adding custom image step to update artifact name after build is done).

---

<div class="post-metadata">

### Author: ![samlewis](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/samlewis/32/393_2.png) [@samlewis](https://hub.mender.io/u/samlewis)
#### Post date: [July 31, 2019, 12:48am UTC](https://hub.mender.io/t/howto-mender-artifact-name-automatic-setup-for-yocto-build/468/4 "2019-07-31T00:48:39Z")

</div>

Recently had to do this too, found it helpful to have `IMAGE_BASENAME := "${MENDER_ARTIFACT_NAME}"` as well so that my `sdimg` artifact also had the name of the artifact.

Also can recommend using [kas](https://github.com/siemens/kas) for managing the Yocto build and injecting variables for this sort of thing. It’s a really nice tool.

---

<div class="post-metadata">

### Author: ![MarekBelisko](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/marekbelisko/32/33_2.png) [@MarekBelisko](https://hub.mender.io/u/MarekBelisko)
#### Post date: [July 31, 2019, 6:59am UTC](https://hub.mender.io/t/howto-mender-artifact-name-automatic-setup-for-yocto-build/468/5 "2019-07-31T06:59:46Z")

</div>

Shouldn’t it be `IMAGE_BASENAME += ...` ?  
I like kas also 🙂
