Skip to content

Update Task Start/Stop block messages for TeamCityEngine#101

Merged
nils-a merged 1 commit intocake-contrib:developfrom
BlythMeister:teamcity
Nov 25, 2021
Merged

Update Task Start/Stop block messages for TeamCityEngine#101
nils-a merged 1 commit intocake-contrib:developfrom
BlythMeister:teamcity

Conversation

@BlythMeister
Copy link
Copy Markdown
Contributor

@BlythMeister BlythMeister commented Nov 19, 2021

Using the new events, send TeamCity progress and block messages for setup start/end

Fixes: #49

@nils-a
Copy link
Copy Markdown
Contributor

nils-a commented Nov 25, 2021

@BlythMeister I've tested it, and something stuck out to me:

image

Is it intentional, that the output of every task is now printed out "twice"?

@BlythMeister
Copy link
Copy Markdown
Contributor Author

Not sure, I'll investigate

@BlythMeister
Copy link
Copy Markdown
Contributor Author

BlythMeister commented Nov 25, 2021

@nils-a can you share the full teamcity log and the cake script you used to test?
i can't reproduce that.

It looks like every task itself is being run twice.
the

======================
B
======================

log appears twice, and that's a standard CAKE thing rather than TeamCity engine.
and the Hello Cake From B goes twice too..

@BlythMeister
Copy link
Copy Markdown
Contributor Author

BlythMeister commented Nov 25, 2021

the ===== log coming from https://github.com/cake-build/cake/blob/dc75d945afba13963a8f7e8edd04768ace6dc124/src/Cake.Core/DefaultExecutionStrategy.cs?_pjax=div%5Bitemtype%3D%22http%3A%2F%2Fschema.org%2FSoftwareSourceCode%22%5D%20%3E%20main#L62-L76 so i have no idea how your getting that twice now based on my change.

I would be interested in a comparison of the log before this PR change and with it. - i'm wondering if this issue was introduced with cake upgrade rather than my change. because i didn't actually change (apart from rename) the function logging around tasks.

@nils-a
Copy link
Copy Markdown
Contributor

nils-a commented Nov 25, 2021

sure, I used https://github.com/nils-a-demos/test-buildsystems-pr101 to test, and the full log is:

Build 'Cake-Contrib / Test Buildsystems Pr101 / Build' #3, default branch 'main'
Triggered 2021-11-25 12:01:38 by 'admin'
Started 2021-11-25 12:01:39 on agent 'default-agent'
Finished 2021-11-25 12:02:00 with status NORMAL 'Success'
VCS revisions: 'CakeContrib_TestBuildsystemsPr101_HttpsGithubComNilsADemosTestBuildsystemsPr101gitRefsHeadsMain' (Git, instance id 5): '8288bf55dd68b9165422406662f92ce44423890b' (branch: 'refs/heads/main')
TeamCity URL http://localhost:8111/viewLog.html?buildId=503&buildTypeId=CakeContrib_TestBuildsystemsPr101_Build 
TeamCity server version is 2021.1.1 (build 92714), server timezone: CET (UTC+01:00)

[12:01:38]W: bt7 (22s)
[12:01:38]i: TeamCity server version is 2021.1.1 (build 92714)
[12:01:38] : The build is removed from the queue to be prepared for the start
[12:01:38] : Collecting changes in 1 VCS root
[12:01:38] :	 [Collecting changes in 1 VCS root] VCS Root details
[12:01:38] :		 [VCS Root details] "https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main" {instance id=5, parent internal id=5, parent id=CakeContrib_TestBuildsystemsPr101_HttpsGithubComNilsADemosTestBuildsystemsPr101gitRefsHeadsMain, description: "https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main"}
[12:01:38]i:	 [Collecting changes in 1 VCS root] Detecting changes in VCS root 'https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main' (used in 'Build')
[12:01:38]i:	 [Collecting changes in 1 VCS root] Will collect changes for 'https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main' starting from revision 8288bf55dd68b9165422406662f92ce44423890b
[12:01:38] :	 [Collecting changes in 1 VCS root] Compute revision for 'https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main'
[12:01:38] :		 [Compute revision for 'https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main'] Upper limit revision: 8288bf55dd68b9165422406662f92ce44423890b
[12:01:38]i:		 [Compute revision for 'https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main'] MaxModId = null
[12:01:38] :		 [Compute revision for 'https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main'] The first revision that was detected in the branch refs/heads/main: 8288bf55dd68b9165422406662f92ce44423890b
[12:01:38] :		 [Compute revision for 'https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main'] Cannot find modification with revision 8288bf55dd68b9165422406662f92ce44423890b
[12:01:38] :		 [Compute revision for 'https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main'] No modification from VCS root is attached to build configuration and checkout rules include all changes, use upper limit revision
[12:01:38] :		 [Compute revision for 'https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main'] Computed revision: 8288bf55dd68b9165422406662f92ce44423890b
[12:01:38] : Starting the build on the agent "default-agent"
[12:01:39]i: Agent time zone: Europe/Berlin
[12:01:39]i: Agent is running under JRE: 11.0.11+9-Ubuntu-0ubuntu2.20.04
[12:01:39] : Updating tools for build
[12:01:39] :	 [Updating tools for build] Tools are not required for the build
[12:01:39] : Clearing temporary directory: /home/teamcity/buildAgent-data/temp/buildTmp
[12:01:39] : Publishing internal artifacts
[12:01:40] :	 [Publishing internal artifacts] Publishing 1 file using [ArtifactsCachePublisher]
[12:01:40] :	 [Publishing internal artifacts] Publishing 1 file using [WebPublisher]
[12:01:39] : Using vcs information from agent file: e30c68aa8bd126ac.xml
[12:01:39] : Checkout directory: /home/teamcity/buildAgent-data/work/e30c68aa8bd126ac
[12:01:39] : Updating sources: auto checkout (on agent)
[12:01:39] :	 [Updating sources] Will use agent side checkout
[12:01:39] :	 [Updating sources] VCS Root: https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main
[12:01:39] :		 [VCS Root: https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main] revision: 8288bf55dd68b9165422406662f92ce44423890b
[12:01:39]i:		 [VCS Root: https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main] Mirrors automatically enabled
[12:01:39] :		 [VCS Root: https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main] Git version: 2.25.1.0
[12:01:39] :		 [VCS Root: https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main] Update git mirror (/home/teamcity/buildAgent-data/system/git/git-0EE0F70C.git)
[12:01:39] :			 [Update git mirror (/home/teamcity/buildAgent-data/system/git/git-0EE0F70C.git)] /usr/bin/git config http.sslCAInfo
[12:01:39] :			 [Update git mirror (/home/teamcity/buildAgent-data/system/git/git-0EE0F70C.git)] /usr/bin/git show-ref
[12:01:39] :			 [Update git mirror (/home/teamcity/buildAgent-data/system/git/git-0EE0F70C.git)] /usr/bin/git -c credential.helper= ls-remote origin
[12:01:40] :			 [Update git mirror (/home/teamcity/buildAgent-data/system/git/git-0EE0F70C.git)] /usr/bin/git show-ref refs/heads/main
[12:01:40] :			 [Update git mirror (/home/teamcity/buildAgent-data/system/git/git-0EE0F70C.git)] /usr/bin/git log -n1 --pretty=format:%H%x20%s 8288bf55dd68b9165422406662f92ce44423890b --
[12:01:40] :			 [Update git mirror (/home/teamcity/buildAgent-data/system/git/git-0EE0F70C.git)] No 'git fetch' required: commit '8288bf55dd68b9165422406662f92ce44423890b' is in the local repository clone pointed by 'refs/heads/main'.
[12:01:40] :			 [Update git mirror (/home/teamcity/buildAgent-data/system/git/git-0EE0F70C.git)] /usr/bin/git pack-refs --all
[12:01:40] :		 [VCS Root: https://github.com/nils-a-demos/test-buildsystems-pr101.git#refs/heads/main] Update checkout directory (/home/teamcity/buildAgent-data/work/e30c68aa8bd126ac)
[12:01:40] :			 [Update checkout directory (/home/teamcity/buildAgent-data/work/e30c68aa8bd126ac)] /usr/bin/git rev-parse --is-shallow-repository
[12:01:40] :			 [Update checkout directory (/home/teamcity/buildAgent-data/work/e30c68aa8bd126ac)] /usr/bin/git config lfs.storage /home/teamcity/buildAgent-data/system/git/git-0EE0F70C.git/lfs
[12:01:40] :			 [Update checkout directory (/home/teamcity/buildAgent-data/work/e30c68aa8bd126ac)] /usr/bin/git config core.sparseCheckout true
[12:01:40] :			 [Update checkout directory (/home/teamcity/buildAgent-data/work/e30c68aa8bd126ac)] /usr/bin/git config http.sslCAInfo
[12:01:40] :			 [Update checkout directory (/home/teamcity/buildAgent-data/work/e30c68aa8bd126ac)] /usr/bin/git show-ref
[12:01:40] :			 [Update checkout directory (/home/teamcity/buildAgent-data/work/e30c68aa8bd126ac)] /usr/bin/git show-ref refs/remotes/origin/main
[12:01:40] :			 [Update checkout directory (/home/teamcity/buildAgent-data/work/e30c68aa8bd126ac)] /usr/bin/git log -n1 --pretty=format:%H%x20%s 8288bf55dd68b9165422406662f92ce44423890b --
[12:01:40] :			 [Update checkout directory (/home/teamcity/buildAgent-data/work/e30c68aa8bd126ac)] No 'git fetch' required: commit '8288bf55dd68b9165422406662f92ce44423890b' is in the local repository clone pointed by 'refs/remotes/origin/main'.
[12:01:40] :			 [Update checkout directory (/home/teamcity/buildAgent-data/work/e30c68aa8bd126ac)] /usr/bin/git branch
[12:01:40] :			 [Update checkout directory (/home/teamcity/buildAgent-data/work/e30c68aa8bd126ac)] /usr/bin/git -c credential.helper= reset --hard 8288bf55dd68b9165422406662f92ce44423890b
[12:01:40] :			 [Update checkout directory (/home/teamcity/buildAgent-data/work/e30c68aa8bd126ac)] /usr/bin/git branch --set-upstream-to=refs/remotes/origin/main
[12:01:40] : Build preparation done
[12:01:40]W: Step 1/1: Command Line (16s)
[12:01:40]i:	 [Step 1/1] Content of /home/teamcity/buildAgent-data/temp/agentTmp/custom_script17179010449498377538 file: 
bash ./build.sh

[12:01:40] :	 [Step 1/1] Starting: /home/teamcity/buildAgent-data/temp/agentTmp/custom_script17179010449498377538
[12:01:40] :	 [Step 1/1] in directory: /home/teamcity/buildAgent-data/work/e30c68aa8bd126ac
[12:01:40]W:	 [Step 1/1] ++ dirname ./build.sh
[12:01:40]W:	 [Step 1/1] + cd .
[12:01:40]W:	 [Step 1/1] + export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
[12:01:40]W:	 [Step 1/1] + DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
[12:01:40]W:	 [Step 1/1] + export DOTNET_CLI_TELEMETRY_OPTOUT=1
[12:01:40]W:	 [Step 1/1] + DOTNET_CLI_TELEMETRY_OPTOUT=1
[12:01:40]W:	 [Step 1/1] + export DOTNET_NOLOGO=1
[12:01:40]W:	 [Step 1/1] + DOTNET_NOLOGO=1
[12:01:40]W:	 [Step 1/1] + dotnet tool restore
[12:01:50] :	 [Step 1/1] Tool 'cake.tool' (version '2.0.0-rc0001') was restored. Available commands: dotnet-cake
[12:01:50] :	 [Step 1/1] 
[12:01:50] :	 [Step 1/1] Restore was successful.
[12:01:50]W:	 [Step 1/1] + dotnet cake
[12:01:57] :	 [Step 1/1] Cake Build
[12:01:57] :		 [Cake Build] Setup
[12:01:57] :			 [Setup] Running Setup
[12:01:57] :			 [Setup] ----------------------------------------
[12:01:57] :			 [Setup] Setup
[12:01:57] :			 [Setup] ----------------------------------------
[12:01:57] :			 [Setup] Running tasks...
[12:01:57] :		 [Cake Build] A
[12:01:57] :			 [A] Running task A
[12:01:57] :			 [A] ========================================
[12:01:57] :			 [A] A
[12:01:57] :			 [A] ========================================
[12:01:57] :			 [A] Hello Cake from A!
[12:01:57] :		 [Cake Build] B
[12:01:57] :			 [B] Running task B
[12:01:57] :			 [B] ========================================
[12:01:57] :			 [B] B
[12:01:57] :			 [B] ========================================
[12:01:57] :			 [B] Hello Cake from B!
[12:01:57] :		 [Cake Build] C
[12:01:57] :			 [C] Running task C
[12:01:57] :			 [C] ========================================
[12:01:57] :			 [C] C
[12:01:57] :			 [C] ========================================
[12:01:57] :			 [C] Hello Cake from C!
[12:01:57] :		 [Cake Build] Default
[12:01:57] :			 [Default] Running task Default
[12:01:57] :			 [Default] ========================================
[12:01:57] :			 [Default] Default
[12:01:57] :			 [Default] ========================================
[12:01:57] :			 [Default] Hello Cake!
[12:01:57] :		 [Cake Build] Teardown
[12:01:57] :			 [Teardown] Running Teardown
[12:01:57] :			 [Teardown] ----------------------------------------
[12:01:57] :			 [Teardown] Teardown
[12:01:57] :			 [Teardown] ----------------------------------------
[12:01:57] :			 [Teardown] Finished running tasks.
[12:01:57] :	 [Step 1/1] Task                          Duration            
[12:01:57] :	 [Step 1/1] --------------------------------------------------
[12:01:57] :	 [Step 1/1] Setup                         00:00:00.0333251    
[12:01:57] :	 [Step 1/1] A                             00:00:00.0136531    
[12:01:57] :	 [Step 1/1] B                             00:00:00.0054715    
[12:01:57] :	 [Step 1/1] C                             00:00:00.0069129    
[12:01:57] :	 [Step 1/1] Default                       00:00:00.0038435    
[12:01:57] :	 [Step 1/1] Teardown                      00:00:00.0010157    
[12:01:57] :	 [Step 1/1] --------------------------------------------------
[12:01:57] :	 [Step 1/1] Total:                        00:00:00.0642218    
[12:01:57] :	 [Step 1/1] Process exited with code 0
[12:01:57] : Publishing internal artifacts (2s)
[12:02:00] :	 [Publishing internal artifacts] Publishing 1 file using [ArtifactsCachePublisher]
[12:02:00] :	 [Publishing internal artifacts] Publishing 1 file using [WebPublisher]
[12:02:00] : Build finished

@BlythMeister
Copy link
Copy Markdown
Contributor Author

How weird, the raw log doesn't have duplicate lines?
Also, on my teamcity, my whole output looks different to yours.
What version of teamcity are you using?

@nils-a
Copy link
Copy Markdown
Contributor

nils-a commented Nov 25, 2021

It's an older version: 2021.1.1 (build 92714)

And, now, I'm confused, too. 🤣

Cake 1.3 with Cake.BuildSystems.Module 3.1.0 and Cake 2 (preview) with Cake.BuildSystems.Module 4.0.0 (preview)
Has folded sections for Tasks but not for Setup, Teardown
(And again, when viewing the log in the ui, every line of a Task is displayed twice)

I'll do an update of my TC - see if that fixes some things.
The ui is the same, even on a current TC 2021.2

@BlythMeister
Copy link
Copy Markdown
Contributor Author

So my hunch is the environment / teamcity UI is causing the double logging - hence why the raw log doesn't have duplicates.

As to why you got no teardown at all, looking at the code, not sure how my changes "fix" that 🤣

I'm going to bump my cake frosting to use the previews. Not sure how I can test that though with hour our releases work 🤣

@nils-a
Copy link
Copy Markdown
Contributor

nils-a commented Nov 25, 2021

Are you on TC "experimental UI" things look better here, when shown in "experimental UI".

image

@BlythMeister
Copy link
Copy Markdown
Contributor Author

Ohh yeah, i always use that experimental ui!

That probably explains it :)

But, i don't think this change makes the logging worse? - just has the same issue.

@nils-a
Copy link
Copy Markdown
Contributor

nils-a commented Nov 25, 2021

Agreed. Seems classic UI was "broken" before.

Copy link
Copy Markdown
Contributor

@nils-a nils-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nils-a nils-a merged commit 18e2119 into cake-contrib:develop Nov 25, 2021
@BlythMeister BlythMeister deleted the teamcity branch January 20, 2022 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include Task Block Logic Around Build Setup & Teardown

2 participants