Try building and add env flag
This commit is contained in:
parent
1af6275c43
commit
b1a453ef21
49
.github/workflows/container-stable.yaml
vendored
49
.github/workflows/container-stable.yaml
vendored
@ -3,10 +3,10 @@ name: "Stable container"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "src/**"
|
||||
# branches:
|
||||
# - main
|
||||
# paths:
|
||||
# - "src/**"
|
||||
|
||||
jobs:
|
||||
containerization:
|
||||
@ -41,13 +41,48 @@ jobs:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
push: false
|
||||
tags: |
|
||||
ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}:stable
|
||||
ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}:latest
|
||||
check-da-helm-base
|
||||
labels: |
|
||||
action_id=${{ github.action }}
|
||||
action_link=${{ env.LINK }}
|
||||
actor=${{ github.actor }}
|
||||
sha=${{ github.sha }}
|
||||
ref=${{ github.ref }}
|
||||
|
||||
- name: Build helmfile
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
context: ./dockerfiles
|
||||
file: ./Dockerfile-helmfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: false
|
||||
tags: |
|
||||
ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}-helmfile:latest
|
||||
ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}-helmfile:stable
|
||||
labels: |
|
||||
action_id=${{ github.action }}
|
||||
action_link=${{ env.LINK }}
|
||||
actor=${{ github.actor }}
|
||||
sha=${{ github.sha }}
|
||||
ref=${{ github.ref }}
|
||||
|
||||
- name: Build argo
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
context: ./dockerfiles
|
||||
file: ./Dockerfile-argo
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: false
|
||||
tags: |
|
||||
ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}-argo:latest
|
||||
ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}-argo:stable
|
||||
labels: |
|
||||
action_id=${{ github.action }}
|
||||
action_link=${{ env.LINK }}
|
||||
actor=${{ github.actor }}
|
||||
sha=${{ github.sha }}
|
||||
ref=${{ github.ref }}
|
||||
|
@ -8,13 +8,15 @@ use std::{borrow::Borrow, io::Result, process::Command};
|
||||
|
||||
pub(crate) struct Helmfile {
|
||||
path: String,
|
||||
env: String,
|
||||
}
|
||||
|
||||
impl Connector for Helmfile {
|
||||
fn get_app(&self) -> Result<Vec<types::HelmChart>> {
|
||||
let cmd: String = format!(
|
||||
"helmfile -f {} list --output json | jq '[.[] | {{chart: .name, version: .version}}]'",
|
||||
self.path
|
||||
"helmfile -f {} -e {} list --output json | jq '[.[] | {{chart: .name, version: .version}}]'",
|
||||
self.path,
|
||||
self.env
|
||||
)
|
||||
.to_string();
|
||||
|
||||
@ -35,7 +37,7 @@ impl Connector for Helmfile {
|
||||
}
|
||||
}
|
||||
fn sync_repos(&self) -> Result<()> {
|
||||
let cmd: String = format!("helmfile -f {} sync", self.path);
|
||||
let cmd: String = format!("helmfile -f {} -e {} sync", self.path, self.env);
|
||||
Command::new("bash")
|
||||
.arg("-c")
|
||||
.arg(cmd)
|
||||
@ -47,7 +49,7 @@ impl Connector for Helmfile {
|
||||
type ConnectorType = Helmfile;
|
||||
}
|
||||
impl Helmfile {
|
||||
pub(crate) fn init(path: String) -> Self {
|
||||
Self { path: path }
|
||||
pub(crate) fn init(path: String, env: String) -> Self {
|
||||
Self {path, env}
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,9 @@ struct Args {
|
||||
/// Path to the helmfile
|
||||
#[clap(short, long, value_parser, default_value = "./")]
|
||||
path: String,
|
||||
/// Pass an environment to the helmfile
|
||||
#[arg(long, required = false, default_value = "default")]
|
||||
helmfile_environment: String,
|
||||
/// Should execution be failed if you have outdated charts
|
||||
#[clap(short, long, action, default_value_t = false, env = "OUTDATED_FAIL")]
|
||||
outdated_fail: bool,
|
||||
@ -85,7 +88,7 @@ fn main() {
|
||||
let charts = match args.kind {
|
||||
Kinds::Argo => Argo::init().get_app(),
|
||||
Kinds::Helm => Helm::init().get_app(),
|
||||
Kinds::Helmfile => Helmfile::init(args.path.clone()).get_app(),
|
||||
Kinds::Helmfile => Helmfile::init(args.path.clone(), args.helmfile_environment.clone()).get_app(),
|
||||
}
|
||||
.unwrap();
|
||||
|
||||
@ -94,7 +97,7 @@ fn main() {
|
||||
let res = match args.kind {
|
||||
Kinds::Argo => Argo::init().sync_repos(),
|
||||
Kinds::Helm => Helm::init().sync_repos(),
|
||||
Kinds::Helmfile => Helmfile::init(args.path).sync_repos(),
|
||||
Kinds::Helmfile => Helmfile::init(args.path, args.helmfile_environment).sync_repos(),
|
||||
};
|
||||
match res {
|
||||
Ok(_) => info!("helm repos are synced"),
|
||||
|
Reference in New Issue
Block a user