Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Tomasz Cielecki
@Cheesebaron
What do you mean?
Tomasz Cielecki
@Cheesebaron
Are you referring to my issue? Then... I run a cake script 3 times one time for ios, one time for android and another one for a different android platform. Instead of having to call AzurePipelines.Commands.SetVariable() with a unique variable name for each of these executions. I could do this with the same variable name, just where isOutput=true. Then I could name the 3 cake script executions and refer them like: $(ios.releaseData), $(android.releaseData) etc., instead.
Nick
@nick5454
I use a custom cake nuget and define the vars in yml then pass in SetParameters instead for multi platform builds
Tomasz Cielecki
@Cheesebaron
This is not for builds, but for deployments. I need the result from inside the cake script to be available in another task.
Stefan Ossendorf
@StefanOssendorf
Hi. Is it possible to open a browser with a specified html-file?
These two solutions somehow do not work: https://stackoverflow.com/questions/41722455/how-to-launch-html-report-from-cake-build
I get this error:
Error: One or more errors occurred. (The specified executable is not a valid application for this OS platform.) The specified executable is not a valid application for this OS platform.
The path to the html file is correct. I print that out just before the StartProcess call.
Stefan Ossendorf
@StefanOssendorf
The explicit "start cmd" apporach worked :-D
Gary Ewan Park
@gep13
@StefanOssendorf we used to do this in Cake.Recipe in the following way:
I believe for the reason you are describing
Stefan Ossendorf
@StefanOssendorf
Ah thanks :)
Nick
@nick5454
Is there a cake api I can use to install certs and provision on the azure mac host?
Nick
@nick5454
@gep13 do you know if there's a cake api that will allow me to install apple certs and provisions on the mac? I can't find one
10 replies
John Menn
@nedoziznzg_gitlab
Does any one have a workaround for this? cake-build/cake#2593
John Menn
@nedoziznzg_gitlab
image.png
John Menn
@nedoziznzg_gitlab
Can someone point me to where we are requesting for a 3.0.0 framework version, looks like bumping that up to 5 might solve this
Gary Ewan Park
@gep13
@nedoziznzg_gitlab is this an open source project that someone could take a look at?
Calvin Dallmore
@aeos
Is there a best practice for having cake return information back to the build task? For instance if I have cake execute gitversion for the package version, but I also need that information in my jenkins process, is there a defined way to do so? Apart from processing log output or writing it to file?
6 replies
John Menn
@nedoziznzg_gitlab
@gep13 I am running https://github.com/cake-build/cake/ on the develop branch
7 replies
John Menn
@nedoziznzg_gitlab
image.png
Pascal Berger
@pascalberger

@/all A quick reminder that we suggest to use GitHub discussions as prefered communication channel. GitHub discussions makes it easier to keep track of discussions in a structured way, especially if multiple discussions are happening at the same time. It also allows to search for previous discussion, which can be a helpful resource. GitHub discussions should be a place for the community like here, and we would be more than happy if community would chime in to discussions over there.

We won't delete this channel, but discussions might move to the new place which is available at: https://github.com/cake-build/cake/discussions

Mattias Karlsson
@devlead
@/all We will soon start preparing for the 1.0.0-rc0002 release of Cake. So this is a friendly reminder to pin your Cake version.
cake-contrib-bot
@cake-contrib-bot
@/all Version 1.0.0-rc0002 of the Cake has just been released, https://www.nuget.org/packages/Cake.
Dmitry Lukyanov
@dmitry_lukyanov_gitlab
Hey, why there is no predefined Nuget "wrappers" for dotnet add package ... here: https://cakebuild.net/dsl/dotnetcore/#NuGet?
as I understand, if I need to call this command, the only option I have is just: StartProcess("dotnet", new ProcessSettings { Arguments = argumentsBuilder, WorkingDirectory = workingDirectory })? Why so? :)
Mattias Karlsson
@devlead
If there isn't, it's probably because no one has contributed it yet. Please raise an issue and someone might pick it up.
For generic .NET commands DotNetCoreTool alias might be better suited than StartProcess
CharliePoole
@CharliePoole

Looking for input / feedback...

I have a lightweight test framework I call tclite. It's somewhat modelled after NUnit and NUnitLite, but with some differences. One use I have for it is to write tests in my cake scripts. For me, these are mostly system tests, which create output in XML format. I could, of course, have a separate test assembly to verify the format of the output, but I found it more convenient that my tests should live in the scripts themselves.

Currently, my mini-test-framework lives in a set of .cake files but it could be in a separate assembly referenced by the script.

So... questions...

  1. Would you find this useful in your own work?
  2. What features does it need to have?
  3. Would you rather see it distributed as source files or as a nuget package?

I suggest short answers here, longer via my email, which is my name here on gmail.

Pascal Berger
@pascalberger

@CharliePoole We have question how to implement tests in Cake scripts from time to time here, so I assume something like this would be useful for some people.

Btw we started to use mainly GitHub discussions instead of this Gitter channel.
You might want to post there too for better coverage.

Question 3: NuGet package. You can distribute .cake files as NuGet packages. It's what we call Recipe NuGet packages
Pascal Berger
@pascalberger

Question 2:

  • Code of a certain complexity I often have in an addin, where any existing testing framework can be used.
  • I normally work with recipe scripts (e.g. Cake.Recipe for OSS stuff) which contain most of the complexity and leave nearly no logic in repo build scripts

So my use cases for something you suggested are mainly for testing of the recipe scripts, where I see two main use cases:

  1. Unit testing of helper classes. Features required there is an assertion framework and the possibility to fail build script at the end
  2. Integration tests. I normally implement them by adding a separate test Cake script which uses the NuGet package built. Here is an example for Cake.Issues.Recipe.
    This allows to create a build pipeline which tests the actual package on different platforms, build servers, runners (e.g. here is the Azure Pipeline for the above script).
    The example above tests "only" calling the functionality of the recipe script, but doesn't currently tests the outcome or fails the test if outcome is not like the expected result.
    To implement tests here I would look for the same features as for point 1.
CharliePoole
@CharliePoole

@pascalberger Thanks for the feedback.

I was aware of Cake.Recipe, which is a much bigger set of scripts than I cared to deal with, but not of the possibility to have individual recipe nuget packages. So I'll look into that for sure.

CharliePoole
@CharliePoole

It's interesting that my own greatest need for this has come in testing extensions to the NUnit engine, where I don't want to write a test host to simulate completely the behavior of NUnit console and it's engine in calling the extension, because that's complex and error-prone and will need to be modified any time the engine is changed. But others would no doubt find different uses.

Anyway, I'm thinking that making it available to folks is the best way to find out what those uses are.

I'll move this to the GitHub discussions as you suggest.

Marek Pavlu
@ipavlu

Hi, I am trying Cake.AzureDevOps, trying to get pull request:
var pullRequestSettings =
new AzureDevOpsPullRequestSettings(
new Uri("http://myazuredevops/DefaultCollection/project/_git/CoreServices"),
"refs/heads/master",
AzureDevOpsAuthenticationNtlm());

var pullRequest =
AzureDevOpsPullRequest(
pullRequestSettings);

here it fails:
Error: System.AggregateException: One or more errors occurred. (Pull request not found)
---> Cake.AzureDevOps.Repos.PullRequest.AzureDevOpsPullRequestNotFoundException: Pull request not found

Please tell me, somebody, what am I horribly not realizing /missing? :).
Thanks...

Nils Andresen
@nils-a
@ipavlu I think Cake.AzureDevOps has some fair logging. Have you tried running with --verbosity=diagnostic?
Tanner Watson
@tannerwatson
Forgive my ignorance regarding python and pip. Do you think it would be possible to develop a pip module that would work similarly to the Cake.Npm.Module and Cake.Chocolatey.Module? I would think so, but not sure if there would be any gotchas with dependencies and such
bravecobra
@bravecobra
Hi, I'm trying to get reading and writing to the windows registry working through a Cake script. Anybody got an example?
I want to read from HKEY_CURRENT_USER
C. Augusto Proiete
@augustoproiete

@bravecobra Indeed, HKCU is not exposed in IRegistry and WindowsRegistryKey is internal which makes it harder for you to create your own reference to HKCU using IRegistryKey.

You'll have to use the Registry classes directly from Microsoft.Win32.Registry instead of using the Cake abstraction.

C. Augusto Proiete
@augustoproiete
@bravecobra cake-build/cake#3024
bravecobra
@bravecobra
@augustoproiete tnx for opening that issue. For now I can get away with reg.exe import, but being able to do that directly from Cake would be better. I'll await the implementation, which I guess won't be too hard.
Pascal Berger
@pascalberger

@ipavlu The source branch in the AzureDevOpsPullRequestSettings seems to be wrong:

var pullRequestSettings =
new AzureDevOpsPullRequestSettings(
new Uri("http://myazuredevops/DefaultCollection/project/_git/CoreServices"),
"refs/heads/master",
AzureDevOpsAuthenticationNtlm());

refs/heads/master needs to be the branch which you want to merge with the pull request (feature/topic branch), not the target branch.

C. Augusto Proiete
@augustoproiete

@bravecobra You're welcome. You absolutely can use Cake to interact with the Registry... You just can't use the Cake abstraction to it (yet) for your use-case.

Using the .NET classes directly should work just fine e.g.

using Microsoft.Win32;

var hkcu = Registry.CurrentUser;
var subKeyNames = hkcu.GetSubKeyNames();
foreach (var name in subKeyNames)
{
    Information("Key name: {0}", name);
}
C. Augusto Proiete
@augustoproiete

@tannerwatson :point_up: January 5, 2021 4:00 PM It should be fairly easy to implement a module for Pip similar to the Npm one if you take the same approach as the Npm module of executing Pip via ProcessRunner. In that case the only dependency you'll have is Python/Pip, which users might already have on the machine, or you can instruct users to download Python from NuGet as a tool e.g.

#module nuget:?package=Cake.Pip.Module&version=x.y.z
#tool "nuget:?package=python&version=3.9.1"
#tool "pip:?package=setuptools&version=49.2.1"

// ...

Alternatively you can implement the Pip protocol yourself - which would be more elegant, but with more work involved.

Calvin Dallmore
@aeos
I might be doing this wrong, but I noticed that if you upgrade a reference in your cake build script context.Tools.Resolve(string) may find the tool from the previous version which still exists in the tools folder. Should we always clear out the tools directory before changing a package reference?
Mattias Karlsson
@devlead
Are you fetching tools using tool preprocessor directive? Think tool directive should register binaries for right version, but quite possible having multiple versions of same tool potentially causing issues.
Calvin Dallmore
@aeos
I might be abusing the feature. I have a docker template that I include as a nuget package, and then look for it using resolve in a build step.
C. Augusto Proiete
@augustoproiete

I might be doing this wrong, but I noticed that if you upgrade a reference in your cake build script context.Tools.Resolve(string) may find the tool from the previous version which still exists in the tools folder. Should we always clear out the tools directory before changing a package reference?

@aeos I ran a few tests just now and was not able to reproduce it. This is what I've done:

tools1.cake:

#tool "nuget:?package=python&version=3.9.1"

var pythonExePath = Context.Tools.Resolve("python.exe");

var exitCode = StartProcess(pythonExePath, "--version");
Information("Exit code: {0}", exitCode);

tools2.cake:

#tool "nuget:?package=python&version=3.10.0-a4&prerelease"

var pythonExePath = Context.Tools.Resolve("python.exe");

var exitCode = StartProcess(pythonExePath, "--version");
Information("Exit code: {0}", exitCode);