Request for hosting plugin: build-timestamp

120 views
Skip to first unread message

Hao Chen

unread,
Dec 16, 2015, 4:15:57 AM12/16/15
to Jenkins Developers
Hi,
I'd like to create a plugin to expose build timestamp to as env vars.

This plugin allows users to set timezone so that Daylight Saving Time will be displayed correctly if you need.
And also allows users to set more timestamp var names and formats, so they can be used in different places.

This is useful when you need to sync the built war to AWS S3, name the file with a build timestamp helps a lot to identify each other.

 • plugin name: Build Timestamp Plugin (I hope the repo can be 'build-timestamp')
 • my github ID: orctom

Thanks,
Hao

Daniel Beck

unread,
Dec 16, 2015, 7:58:28 PM12/16/15
to jenkin...@googlegroups.com
We generally fork existing plugin repositories. So just start work in a repo under your user account, and once you have an initial version, we can fork into jenkinsci before you release.
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/fc518ad8-5bf6-4b95-9e7d-d4ea23159148%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Hao Chen

unread,
Dec 16, 2015, 8:51:14 PM12/16/15
to Jenkins Developers, m...@beckweb.net
Hi, 

Thanks!

Hao Chen

unread,
Dec 17, 2015, 10:40:15 PM12/17/15
to Jenkins Developers, m...@beckweb.net


On Thursday, December 17, 2015 at 8:58:28 AM UTC+8, Daniel Beck wrote:

Daniel Beck

unread,
Dec 18, 2015, 4:17:19 AM12/18/15
to jenkin...@googlegroups.com

On 16.12.2015, at 10:15, Hao Chen <orc...@gmail.com> wrote:

> I'd like to create a plugin to expose build timestamp to as env vars.

This looks really similar to ZenTimstamp plugin -- why are you not using that? Timezone support could be added if that's missing.

Hao CHEN

unread,
Dec 18, 2015, 4:58:12 AM12/18/15
to jenkin...@googlegroups.com
I cloned the repo to local and read the source code before I decided to create a different one. 
ZenTimestamp exports only one variable to the build, but can be configured to use different formats for each job and each node. 

While I need to
1. Time zone support, which is relatively  easy to add to zentimestamp
2. More timestamp variables and formats. A same timestamp with different formats, can be used in different places, such as folder names or file names using a path friendly format, JSP pages using a human friendly formats. And these formats are set up only once in global config, they can be used in the corp-width as a naming convention. 
To do this is almost changing every thing in ZenTimestamp. 

Hao CHEN

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/X5YdoL6IjdI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/F23577C3-4B37-43B0-916E-CC0BA61F453E%40beckweb.net.

Baptiste Mathus

unread,
Dec 18, 2015, 8:53:26 AM12/18/15
to jenkin...@googlegroups.com
Hi,


The second one explicitly lists TZ as a goal.

Did/would you consider contributing your additional feature(s) to one of them?

Maybe it'd be beneficial to users to have a bit more unity in that field?

Cheers


--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/BAY407-EAS416052DF8A3F0AF609426ECC7E10%40phx.gbl.

For more options, visit https://groups.google.com/d/optout.



--
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !

Hao Chen

unread,
Dec 18, 2015, 9:09:04 AM12/18/15
to jenkin...@googlegroups.com, jenkin...@googlegroups.com
If I recall correctly, timestamper plugin is totally a different thing, it adds timestamps to the build console of each line. While secondary-timestamper is to set an extra timestamp as description in the build history list. 

Each plugin has a different purpose. 


Hao


Slide

unread,
Dec 18, 2015, 9:15:51 AM12/18/15
to jenkin...@googlegroups.com

There is another plugin which provides a BUILD_TIMESTAMP environment variable and allows some formatting. Zentimestamp or something like that. Could the functionality you are adding be added to that existing plugin?


Hao Chen

unread,
Dec 18, 2015, 9:35:11 AM12/18/15
to jenkin...@googlegroups.com, jenkin...@googlegroups.com
I had explained the difference between ZenTimestamp and the one I'm creating. 

I cloned ZenTimestamp to my workspace and read the source code of it, then I decided to create this plugin. 

I need to add more timestamp variables with different formats for different use cases. 
While ZenTimestamp allows you to export only one variable, but you can use different formats in each node and each job. 
Adding the feature to ZenTimestamp, makes it wired. 

It's from a different practice. 


Hao


Benjamin Lau

unread,
Dec 18, 2015, 9:56:31 AM12/18/15
to jenkin...@googlegroups.com
If you want the value in an environment variable I assume you're using it in a bit of shell code (maybe a bad assumption). But if that's the case why not just generate the other formats using the date command?

BUILD_TIMESTAMP_AWS=$(date -d "@$(date -d "$BUILD_TIME_STAMP" +%s)" +%Y%m%d-%H%M%S)

or something of that nature. Not sure what value is in the existing environment variable... and if it's a unix time... you can simplify things like this:

BUILD_TIMESTAMP_AWS=$(date -d "@$BUILD_TIMESTAMP" +%Y%m%d-%H%M%S)

Hao Chen

unread,
Dec 18, 2015, 10:14:38 AM12/18/15
to jenkin...@googlegroups.com, jenkin...@googlegroups.com
No, she'll not involved. 
But Maven and Gradle related. 

I used to set timestamps in Maven and Gradle, to filter package build info properties, to archive build packages with a timestamp (in Maven and Gradle plugins). This requires a same timestamp with different formats. 

Until I stared to work with AWS, when you try to deploy package to Elastic Beanstalk and put a copy to S3 bucket, you will find there's no way to name the version in Elastic Beanstalk, and the archive in S3 bucket with a timestamp, with Jenkins plugin. (BTW, there are two Elastic Beanstalk plugins, and one of them is a fork of the other one)

And in Maven and Gralde, we can use those timestamp variables. One timestamp, different formats, keeps the built artifacts and the job history info consistent. 


Hao


Daniel Beck

unread,
Dec 22, 2015, 5:56:12 PM12/22/15
to jenkin...@googlegroups.com
Forked to https://github.com/jenkinsci/build-timestamp-plugin

Still not entirely sure the use case is sufficiently different, but not convinced it's not either.

There's a corresponding component for the plugin on issues.jenkins-ci.org and you're the default assignee.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/1450451672493.e8d0866f%40Nodemailer.

Hao Chen

unread,
Dec 22, 2015, 6:02:54 PM12/22/15
to jenkin...@googlegroups.com, jenkin...@googlegroups.com
Thank you buddy!


Hao


Reply all
Reply to author
Forward
0 new messages