Opened 5 years ago

Last modified 3 years ago

#2524 new defect

Property('buildnumber') returns None on first build

Reported by: cmumford Owned by:
Priority: major Milestone: 0.9.+
Version: 0.8.7p1 Keywords: simple, tests, sprint
Cc:

Description

When using Property() in ShellCommand? it will always fail on the first build - at least when reading the 'buildnumber' property.

I created a default master/slave and added this one line to the default factory.

factory.addStep(ShellCommand?(command=["echo", Property('buildnumber')],

description=Interpolate('build #%(prop:buildnumber)s')))

And when running the first build you will see this in the build #0 stdio:

argv: ['echo', 'None']

But on build #1 (second build) you will see the correct value:

argv: ['echo', '1']

Attachments (1)

buildbot_property_bug.tgz (162.0 KB) - added by cmumford 5 years ago.
Default master/config with the one step added in this description.

Download all attachments as: .zip

Change History (7)

Changed 5 years ago by cmumford

Default master/config with the one step added in this description.

comment:1 Changed 5 years ago by dustin

  • Milestone changed from undecided to 0.9.0

We'll be assigning build numbers much earlier in the process in nine.

comment:2 Changed 5 years ago by dustin

This should get an integration test of some sort to verify it works now.

comment:3 Changed 4 years ago by dustin

  • Keywords simple tests added
  • Milestone changed from 0.9.0 to 0.9.+

comment:4 Changed 4 years ago by dustin

  • Milestone changed from 0.9.+ to 0.8.x

This was discussed in a pull request recently. The problem isn't that the buildnumber wasn't assigned; it's that Property defaults to its second parameter (which defaults to None) if the property evaluates to something Python considers false, unless its third parameter is true.

The fix is in https://github.com/buildbot/buildbot/pull/1552.

comment:5 Changed 3 years ago by dustin

  • Keywords sprint added
  • Milestone changed from 0.8.x to 0.9.0

From pull 1552, which appears to be stalled:

If prop 'foo' is False and prop 'nosuch' does not exist, then:

  • Property('foo') should evaluate to False
  • Property('foo', 'bar') should evaluate to False
  • Property('foo', 'bar', defaulWhenFalse=False) should evaluate to False
  • Property('foo', 'bar', defaulWhenFalse=False) should evaluate to False
  • Property('foo', defaultWhenFalse=True) should evaluate to None
  • Property('foo', 'bar', defaultWhenFalse=True) should evaluate to "bar"
  • Property('nosuch') should raise an exception
  • Property('nosuch', 'bar') should evaluate to "bar"
  • Property('nosuch', 'bar', defaultWhenFalse=False) should evaluate to "bar"
  • Property('nosuch', 'bar', defaultWhenFalse=True) should evaluate to "bar"

with documentation updated to correspond.

comment:6 Changed 3 years ago by dustin

  • Milestone changed from 0.9.0 to 0.9.+
Note: See TracTickets for help on using tickets.