West silently failing to clone repo in Azure DevOps Pipeline

I'm trying to get a basic CI/CD pipeline working in Azure DevOps, using Azure hosted agents, and I'm running into a problem where West is silently failing to clone the project repo on west init.

Initializing the project on my development machine gives this output:

C:\Repos\westtest>west init -m dev.azure.com/.../westTest
=== Initializing in C:\Repos\westtest
--- Cloning manifest repository from dev.azure.com/.../westTest
Cloning into 'C:\Repos\westtest\.west\manifest-tmp'...
remote: Azure Repos
remote: Found 65 objects to send. (53 ms)
Unpacking objects: 100% (65/65), 9.81 KiB | 33.00 KiB/s, done.
--- setting manifest.path to westTest
=== Initialized. Now run "west update" inside C:\Repos\westtest.

The pipeline requires an access token to to be inserted into the URL so it can authenticate correctly, so the pipeline is running

west init -m https://$(System.AccessToken)@dev.azure.com/{org}/sandbox/_git/westTest

which outputs

=== Initializing in /home/vsts/work/1/s
--- Cloning manifest repository from https://***

Cloning into '/home/vsts/work/1/s/.west/manifest-tmp'...
--- setting manifest.path to westTest

=== Initialized. Now run "west update" inside /home/vsts/work/1/s.

The output here is missing the two "remote:" and "unpacking objects" steps that I get on my development machine.  It looks like it's silently failing to clone the repo in the DevOps pipeline.  Running west init and west update both succeed.  There are no error messages in the build log.

There's a step to list out the contents of the working folder, $(Build.Repository.LocalPath), after running west init and west update.  It shows the entire nRF Connect SDK is correctly downloaded into the working folder, but the actual project repo is missing.

My questions are

- Is it expected that West would silently fail to clone the project repo under these circumstances?

- Are there any guidelines to how to structure or use nRF Connect in a CI/CD system?

Parents Reply
  • Hi Sigurd,

    I read through those links (thank you) and did some more work today with setting up a CI/CD pipeline in Azure DevOps. 

    At the very high level, I think I need a command line equivalent of the "Add Build Configuration" wizard in the nRF Connect VSCode plugin.  The reason for that is most (all?) of my team is going to be using the nRF Connect plugin for development work, and I want the CI/CD environment to be consistent with the developer environment  I looked around to see if something like that exists and I couldn't find anything.

    Is there a way to get verbose output from the "Add Build Configuration" wizard? I'd like to see how it sets up and configures the SDK and toolchain settings.  

Children
  • CurtisHx2 said:
    At the very high level, I think I need a command line equivalent of the "Add Build Configuration" wizard in the nRF Connect VSCode plugin.  The reason for that is most (all?) of my team is going to be using the nRF Connect plugin for development work, and I want the CI/CD environment to be consistent with the developer environment  I looked around to see if something like that exists and I couldn't find anything.

    The VS Code extension just uses "west" under the hood, so you can use "west" command all the same.

    Here you can see the exact command that VS COde uses when you click build:

  • That is what I started with, and I ran into a few different problems with getting the environment properly setup outside of VSCode.  I think I have a viable path forward.  This is mainly for anyone else who's trying to do something similar.

    The environment is Windows 10/11, using the Zephyr Workspace structure, with the latest version of nRF Connect (3.0.99) and nRF Connect SDK Toolchain V3.0.2.  We're using Azure hosted build agents, which are created and destroyed for each run. There's no persistent environment.  It has to be setup on every run.

    There's a few steps that need to be run in order to mimic the build environment provided by the nRF Connect VSCode Plugin.  A python virtual environment should probably be used.

    - Install python requirements in <west workspace>/zephyr/scripts/requirements.txt

    - Install python requirements in <west workspace>/nrf/scripts/requirements.txt

    - Use nrfutil toolchain-manager to install the desired toolchain. 

    The last part is going to require some work.  Inside of the toolchain folder (eg. C:\ncs\toolchains\0b393f9e1b), there is an environment.json file.  This file lists the environment variables that need to be setup and how they need to be setup (eg. append, overwrite, etc).  I couldn't find an off the shelf tool, but it shouldn't be too difficult to make a Python script that can do it.

    Edit: The main reason why I'm taking this route is it lets us use Azure hosted agents, it keeps the CI/CD environment extremely close to the developer environment, and it lets developers use the nRF Connect plugin and its GUI tools.  We have a project with a different structure that doesn't work with the nRF Connect plugin. 

  • CurtisHx2 said:
    - Use nrfutil toolchain-manager to install the desired toolchain. 

    Try to  Start toolchain environment. With this, nrfutil toolchain-manager should set up the environment for you.

    Alterativley, you can install the SDK and toolchain manually, following the System-wide installation

Related