Offline access
Closed this issue · 11 comments
Is there any recommendations on how to utilise the bootstrapper on machines without internet access?
Our CI build agent machines cannot download anything directly but we can use proxy nuget and chocolatey sources, but the hard coded download paths in the bootstrapper script will not be allowed on our network so I'm looking for the bootstrapper to use one of those feeds instead.
@wwwlicious I recently went through this process for the talk that I gave at DDD Scotland. You can see the outcome of this here:
https://github.com/gep13/CakeDemos
I have just noticed that the bootstrapper that I used in the demo isn't included in the repo, I will need to fix that. For now, you can find it here:
https://gist.github.com/gep13/729039aeb4116dfd6be32d66cc196849
NOTE: the usage of the localhost URL for the NuGet feed.
On top of that change, you might want to take a look at the cake.config file in that repo, which allows the customisation of where the required Roslyn NuGet packages can be located. For more information in the Cake Configuration, have a look here:
http://cakebuild.net/docs/fundamentals/configuration
Hope that helps!
@gep13 Thanks, will take a look tomorrow. FYI, I was the one who rudely interrupted you at that talk to ask about configuring custom nuget sources so I have the cake.config sorted ;) #brokenrecord!
@wwwlicious ha ha, gotcha! 😄 Let me know how you get on, and if you have any other questions.
I'm running into an issue with tooling from the script build.cake
.
So far I have created an internal repo containing, nuget.exe
and packages.config
and modified the urls to get them from it.
I also added a variable to the script
$NUGET_SOURCE = "<our source>"
which I added to the line for installing the packages in packages.config
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -Source `"$NUGET_SOURCE`" -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
This now correctly runs the bootstrapper and launches the cake.exe
Now though, when resolving the #tool directives, the package source is not being taken from the cake.config
file and instead is coming from the default so it fails to install the script tooling.
@wwwlicious You can specify the source in the #tool directive like #tool "nuget:https://myfeed.com/?package=Test"
. We will add a mechanism to control the default feed via the cake.config
file.
@wwwlicious you can see this in action in here:
https://github.com/gep13/CakeDemos/blob/master/Demos/Demo%204%20-%20Complete.cake#L4
@gep13 @patriksvensson thank you both.
So a couple of things I've found
- you cannot use variables in the # directives
- the preprocessor directives do not support non-default nuget servers as I am getting an error when the package download does not require a 'package' querystring.
Error: Query string parameter 'package' is missing in package reference.
Parameter name: uri
Might be easier for the time being to pass in the source to cake commandline in the build.ps1 script, will try that next.
@wwwlicious The preprocessor directives is processed before any script execution occurs so variables won't work there. The package parameter is a requirement for Cake to know what it should download and where it should place it.
Yes, makes perfect sense that preprocessor directives don't do variables, just me being a wally :)
Tried setting via cake commandline but it is only setting the same value as cake.config
Invoke-Expression "& "$CAKE_EXE
" "$Script
" -target="$Target
" --roslyn_nugetsource=$NUGET_SOURCE -configuration="$Configuration
" -verbosity="$Verbosity
" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
submitted PR for this cake-build/cake#946
@wwwlicious I am going to go ahead and close this issue, as I think it has been resolved. Feel free to re-open if there are still questions. Thanks!