Hi All,
I need to get the current timestamp in a CI/CD pipeline script (yml). I tried to do it like this:
- buildtimestamp=$(date +%N)
- echo $buildtimestamp
- mvn -s maven_settings.xml -Dbuild_timestamp=$buildtimestamp -DskipTests=true -Ddocker_registry=$docker_registry_dev -P docker docker:build
I have a couple of projects, some projects working well, but there are three projects, which print an empty string. I tried to use - export buildtimestamp=$(date +%N), but it didn't help.
Is there any other method to get the current timestamp?
thx
Zamek
Hi @zamek z
Can you add `echo $(date +%N)` (or whatever the buildtimestamp operation is) to those projects that are failing to confirm that the operation can be successfully called.
Cheers,
Tom
Hi Thomas,
Yes I added like this:
- buildtimestamp=$(date +%N)
- echo $buildtimestamp
- mvn -s maven_settings.xml -Dbuild_timestamp=$buildtimestamp -DskipTests=true -Ddocker_registry=$docker_registry_dev -P docker docker:build
Nowaday I changed %+N to %+s which is the epoch time (N means nanoseconds only). Since I changed to %+s there was no problem.
thx,
Zamek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.