feat: add system time
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-03-30 14:33:36 +01:00
parent 5234c1da89
commit 0d744623ce
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394

View File

@ -1,4 +1,4 @@
use std::path::PathBuf; use std::{path::PathBuf, time::UNIX_EPOCH};
const DRONE_TEMPLATER_IMAGE: &str = "kasperhermansen/drone-templater:main-1711805042"; const DRONE_TEMPLATER_IMAGE: &str = "kasperhermansen/drone-templater:main-1711805042";
@ -32,9 +32,14 @@ impl MainAction for DroneTemplater {
let drone_token_secret = self.client.set_secret("DRONE_TOKEN", drone_token); let drone_token_secret = self.client.set_secret("DRONE_TOKEN", drone_token);
let now = std::time::SystemTime::now()
.duration_since(UNIX_EPOCH)
.context("failed to get system time")?;
self.client self.client
.container() .container()
.from(DRONE_TEMPLATER_IMAGE) .from(DRONE_TEMPLATER_IMAGE)
.with_exec(vec!["echo", &format!("{}", now.as_secs())])
.with_directory("/src/templates", src) .with_directory("/src/templates", src)
.with_workdir("/src") .with_workdir("/src")
.with_env_variable("DRONE_HOST", drone_host) .with_env_variable("DRONE_HOST", drone_host)