Add docker images #5
49
.github/workflows/container-stable.yaml
vendored
49
.github/workflows/container-stable.yaml
vendored
@ -3,10 +3,10 @@ name: "Stable container"
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
# branches:
|
||||||
- main
|
# - main
|
||||||
paths:
|
# paths:
|
||||||
- "src/**"
|
# - "src/**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
containerization:
|
containerization:
|
||||||
@ -41,13 +41,48 @@ jobs:
|
|||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: false
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}:stable
|
check-da-helm-base
|
||||||
ghcr.io/allanger/${{ env.GITHUB_REPOSITORY }}:latest
|
|
||||||
labels: |
|
labels: |
|
||||||
action_id=${{ github.action }}
|
action_id=${{ github.action }}
|
||||||
action_link=${{ env.LINK }}
|
action_link=${{ env.LINK }}
|
||||||
actor=${{ github.actor }}
|
actor=${{ github.actor }}
|
||||||
sha=${{ github.sha }}
|
sha=${{ github.sha }}
|
||||||
ref=${{ github.ref }}
|
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 {
|
pub(crate) struct Helmfile {
|
||||||
path: String,
|
path: String,
|
||||||
|
env: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Connector for Helmfile {
|
impl Connector for Helmfile {
|
||||||
fn get_app(&self) -> Result<Vec<types::HelmChart>> {
|
fn get_app(&self) -> Result<Vec<types::HelmChart>> {
|
||||||
let cmd: String = format!(
|
let cmd: String = format!(
|
||||||
"helmfile -f {} list --output json | jq '[.[] | {{chart: .name, version: .version}}]'",
|
"helmfile -f {} -e {} list --output json | jq '[.[] | {{chart: .name, version: .version}}]'",
|
||||||
self.path
|
self.path,
|
||||||
|
self.env
|
||||||
)
|
)
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
@ -35,7 +37,7 @@ impl Connector for Helmfile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn sync_repos(&self) -> Result<()> {
|
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")
|
Command::new("bash")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(cmd)
|
.arg(cmd)
|
||||||
@ -47,7 +49,7 @@ impl Connector for Helmfile {
|
|||||||
type ConnectorType = Helmfile;
|
type ConnectorType = Helmfile;
|
||||||
}
|
}
|
||||||
impl Helmfile {
|
impl Helmfile {
|
||||||
pub(crate) fn init(path: String) -> Self {
|
pub(crate) fn init(path: String, env: String) -> Self {
|
||||||
Self { path: path }
|
Self {path, env}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,9 @@ struct Args {
|
|||||||
/// Path to the helmfile
|
/// Path to the helmfile
|
||||||
#[clap(short, long, value_parser, default_value = "./")]
|
#[clap(short, long, value_parser, default_value = "./")]
|
||||||
path: String,
|
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
|
/// Should execution be failed if you have outdated charts
|
||||||
#[clap(short, long, action, default_value_t = false, env = "OUTDATED_FAIL")]
|
#[clap(short, long, action, default_value_t = false, env = "OUTDATED_FAIL")]
|
||||||
outdated_fail: bool,
|
outdated_fail: bool,
|
||||||
@ -85,7 +88,7 @@ fn main() {
|
|||||||
let charts = match args.kind {
|
let charts = match args.kind {
|
||||||
Kinds::Argo => Argo::init().get_app(),
|
Kinds::Argo => Argo::init().get_app(),
|
||||||
Kinds::Helm => Helm::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();
|
.unwrap();
|
||||||
|
|
||||||
@ -94,7 +97,7 @@ fn main() {
|
|||||||
let res = match args.kind {
|
let res = match args.kind {
|
||||||
Kinds::Argo => Argo::init().sync_repos(),
|
Kinds::Argo => Argo::init().sync_repos(),
|
||||||
Kinds::Helm => Helm::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 {
|
match res {
|
||||||
Ok(_) => info!("helm repos are synced"),
|
Ok(_) => info!("helm repos are synced"),
|
||||||
|
Reference in New Issue
Block a user