Device UUID

This discussion was created from comments split from: Command line tool version 1.1.0.

Comments

  • csharpsteen
    csharpsteen
    Community Member
    edited June 2020

    What's the proper way to generate a device UUID with v1.1.0?

    Previously, I was able to run the following in a Continuous Integration runner (GitHub Actions):

    eval $(printf '%s' "${OP_TEST_PASSWORD}" |op signin my.1password.com "${OP_TEST_ACCOUNT}" "${OP_TEST_SECRET}")
    

    With 1.1.0 this now fails with:

    [ERROR] 2020/06/13 16:40:41 No saved device ID. Set the OP_DEVICE environment variable and try again: `export OP_DEVICE=xxxxxxxxx`
    

    How should one bootstrap the device ID on a CI runner? Parsing it out of the error message, setting the environment variable, and retrying doesn't feel like a good workflow.

  • felix_1p
    felix_1p
    1Password Alumni

    Parsing it out of the error message, setting the environment variable, and retrying doesn't feel like a good workflow.

    You are right, and that's not how it's intended to be used. For a CI environment, the idea is that you are reusing the same device UUID across all CI runs. Otherwise, and that's what is currently happening in your case I assume, a new device will be registered for every container.

    So create the OP_DEVICE environment variable with the value from the error message in your GitHub actions configuration just once and it should work as expected.

  • csharpsteen
    csharpsteen
    Community Member
    edited June 2020

    In the case of GitHub actions, it's a brand-new ephemeral VM for each CI run instead of a container.

    What's the schema for a valid OP_DEVICE UUID value? It doesn't appear to be a hyphenated string of hex digits that I'm used to seeing.

  • @csharpsteen You should be able to use the same device UUID even if it's a brand-new ephemeral VM rather than a container - did you manage to get this working?

    The device UUIDs are base 32 encoded (following the definition in RFC 4648, but with lowercase characters). The actual UUID data is purely random, so it doesn't follow RFC 4122 (which is the UUID format you'd normally see hyphenated and hex encoded).

  • felix_1p
    felix_1p
    1Password Alumni
    edited June 2020

    @csharpsteen You can just reuse one of the UUIDs included in the error output: export OP_DEVICE=xxxxxxxxx.

  • csharpsteen
    csharpsteen
    Community Member

    @Matthew_1P Thanks! I was able to generate a value with:

    head -c 16 /dev/urandom | base32 | tr -d = | tr '[:upper:]' '[:lower:]'
    

    I could copy a value from the error output, but it is nice to know how to produce one from scratch. Easier to rotate if that is ever needed.

  • Glad to hear that worked out, and thanks for sharing that command, @csharpsteen. :) Hopefully that helps anyone else who might be looking to do the same.

    Ben

This discussion has been closed.