Issues with BuildOptions
Walobyte opened this issue · 5 comments
While attempting to recreate what was deemed 'Closed' here: #95
My goal is to have an azure yaml pipeline pass an (argument) access token into my docker file so that it can complete a dotnet restore with the provided arguments (essentially to authenticate to a private nuget feed).
(for testing purposes, I have this working with a system access token hard coded as an ARG value in the docker file.)
With standalone docker, this should be faily simply, just define the docker command
docker build --build-arg some_variable_name=a_value
From module.json buildOptions:
"buildOptions":[ "--build-args some_variable_name=${a_value_placeholder}" ]
${a_value_placeholder} is described in my .env file which would be populated in my yaml pipeline.
When iotedge calls docker build, no arguments are supplied.
docker build --rm "C...\dockerfile" -t localhost:5000/module:0.0.1
Any insights?
@Walobyte Thank you for bringing this to our attention,
here is the right buildOptions in module.json
"buildOptions": ["--build-arg HTTP_PROXY=${a_value_placeholder}"] ,
add the a_value_placeholder value in env file
a_value_placeholder=http://10.20.30.2:1234
then run command "Azure IoT edge:build and push IoT edge solution", you can see :
"docker build --build-arg HTTP_PROXY=http://10.20.30.2:1234 --rm -f "d:\EdgeSolutionCsharp\modules\SampleModule\Dockerfile.amd64""
@czgtest My apologies on the delayed response.
Tl;dr: Yes, your provided solution worked.
Full explanation:
I am building on arm32v7 platform. I took the assumption that removing the other platforms from the module.json and removing the unneeded dockerfiles would be sufficient as shown here:
However, I was still unable to get it to build correctly. I later found at the bottom of vs code, there is a drop down to select the default platform, even though my solution only contains 1 available platform as shown here:
Once I modified the default target platform, I was successful in building the solution as shown here:
Lastly, I am still unable to get this to build in VS 2019 following the steps I provided in this post. For now, I have switched to only using vs code going further. I understand this github issue is targeted to vs code, so I will open a ticket else where.
Additionally, is there a MS documentation on this subject? The only available sources I could find are through github issues/pull requests. It would be nice to have this further documented. This was a rather difficult issue to overcome such a simple task, hopefully this post can provide others with additional help.
Thank you for your assistance.
@Walobyte here is some doc for using edge extension in VS2019 .
Use Visual Studio 2019 to develop and debug modules for Azure IoT Edge
Easily develop and debug Azure IoT Edge C modules with Azure IoT Edge Tools
if you want to build on arm32v7 platform , you can create arm32v7 project in VS2019
you also can change the platform in your project property
then right-click the project and select build and push IoT edge Modules
@Walobyte, if BuildOptions issue is resolved , you can close this issue,
if you have more questions about using VS2019, you can open new issue here https://github.com/microsoft/vs-azure-iot-edge-docs.