feat: add image tag
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 15:30:59 +01:00
parent e479c79cc9
commit 250807d16f
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394

View File

@ -3,9 +3,9 @@ use std::{collections::BTreeMap, path::PathBuf, time::UNIX_EPOCH};
const DRONE_TEMPLATER_IMAGE: &str = "kasperhermansen/drone-templater:main-1711807810";
use async_trait::async_trait;
use eyre::Context;
use eyre::{Context, OptionExt};
use crate::MainAction;
use crate::{rust_service::RustServiceContext, MainAction};
pub struct DroneTemplater {
client: dagger_sdk::Query,
@ -36,7 +36,11 @@ impl DroneTemplater {
#[async_trait]
impl MainAction for DroneTemplater {
async fn execute_main(&self, _ctx: &mut crate::Context) -> eyre::Result<()> {
async fn execute_main(&self, ctx: &mut crate::Context) -> eyre::Result<()> {
let image_tag = ctx
.get_image_tag()?
.ok_or_eyre(eyre::eyre!("failed to find image tag"))?;
let src = self.client.host().directory(".cuddle/tmp/");
let drone_host = std::env::var("DRONE_HOST").context("DRONE_HOST is missing")?;
@ -59,6 +63,7 @@ impl MainAction for DroneTemplater {
.iter()
.map(|(name, value)| format!(r#"--variable='{name}={value}'"#)),
)
.chain(vec![format!("--variable='image_tag={}'", image_tag)])
.collect::<Vec<_>>();
self.client