Closed bfjelds closed 4 years ago
If you provide the setup steps in the setups
parameter to the template, then you should be all good! Those are also passed to the tarpaulin job.
That was what I expected too. Our setups
is configured like this:
setup:
- script: rustup component add rustfmt
- script: sudo apt install libssl-dev pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav libgstrtspserver-1.0-dev libges-1.0-dev
That works great for build/test/check ... however, this is the output I get for tarpaulin:
Starting: CmdLine
==============================================================================
Task : Command line
Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version : 2.164.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
Script contents:
sudo apt install libssl-dev pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav libgstrtspserver-1.0-dev libges-1.0-dev
========================== Starting Command Output ===========================
/bin/bash --noprofile --norc /__w/_temp/c26d0414-d93b-493c-b35b-8bc0995318f8.sh
/__w/_temp/c26d0414-d93b-493c-b35b-8bc0995318f8.sh: line 1: sudo: command not found
##[error]Bash exited with code '127'.
Finishing: CmdLine
maybe the steps command needs to include apt update
rather than sudo
?
What I'm seeing is that setting setup
to this works in Azure DevOps with build/test, but not tarpaulin:
- script: sudo apt install pkg-config ...
Setting setup to this doesn't work in Azure DevOps with any of build/test/tarpaulin (though it works in docker run for both ubuntu:bionic and xd009642/tarpaulin):
- script: apt update && apt install pkg-config ...
Oh, that's interesting indeed... The sudo: command not found
message makes me think that perhaps the image that tarpaulin
ships simply does not include sudo
. Your version without sudo
won't work on DevOps since your tests aren't run by root
by default (though they may very well be within the tarpaulin docker containers). The solution here I think is to ping @xd009642 and ask if they might consider install sudo
in the bundled image! The alternative is to make your setup steps conditional on whether you are running in a container or not, and run the version with sudo
if you are not, and the version without sudo
if you are.
perfect suggestion ... i'll switch to using a script in my setup and the script can determine whether to use sudo.
one suggestion: it would be nice to have some ability to contribute to the container options in coverage.yml (we have tests that require localhost, and i think i need to specify something like --network host
to enable that)
looks like azure is already configuring a network. nevermind :)
I've been trying out these fantastic DevOps yamls to get my rust project working and I've run into an issue. Basically, my rust project is pulling in crates that have dependencies on things like gstreamer. For build, check, and test, this is no problem ... I added a step to
sudo apt install
whatever I needed. When I started trying out tarpaulin to get some code coverage metrics, I saw failures related to sudo being unrecognized.Is there a workaround or do I need to create my own tarpaulin image?