Include git based version
All checks were successful
Build and deploy / Build container and manifests (push) Successful in 6m29s
All checks were successful
Build and deploy / Build container and manifests (push) Successful in 6m29s
This commit is contained in:
parent
d602220c4b
commit
e9fe169a9a
2
.cargo/config.toml
Normal file
2
.cargo/config.toml
Normal file
|
@ -0,0 +1,2 @@
|
|||
[env]
|
||||
RUSTC_BOOTSTRAP = "1"
|
|
@ -1,3 +1,4 @@
|
|||
*
|
||||
!src
|
||||
!Cargo.*
|
||||
!.cargo/config.toml
|
||||
|
|
|
@ -17,17 +17,13 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
# TODO: Actually set an env variable and use it in the application
|
||||
- name: Set version string
|
||||
- name: Set timestamp and release version
|
||||
run: |
|
||||
git describe --always --dirty="-modified"
|
||||
|
||||
- name: Get Git commit timestamps
|
||||
run: echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
|
||||
echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
|
||||
git fetch --prune --unshallow --tags --force
|
||||
echo "RELEASE_VERSION=$(git describe --always --dirty='--modified')" >> $GITHUB_ENV
|
||||
cat $GITHUB_ENV
|
||||
|
||||
- name: Login to registry
|
||||
uses: docker/login-action@v3
|
||||
|
@ -72,6 +68,8 @@ jobs:
|
|||
annotations: ${{ steps.meta.outputs.annotations }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
build-args: |
|
||||
"RELEASE_VERSION=${{ env.RELEASE_VERSION }}"
|
||||
env:
|
||||
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
|
||||
|
||||
|
|
21
Cargo.lock
generated
21
Cargo.lock
generated
|
@ -97,6 +97,7 @@ dependencies = [
|
|||
"color-eyre",
|
||||
"dotenvy",
|
||||
"futures-util",
|
||||
"git-version",
|
||||
"k8s-openapi",
|
||||
"kube",
|
||||
"schemars",
|
||||
|
@ -555,6 +556,26 @@ version = "0.28.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
|
||||
|
||||
[[package]]
|
||||
name = "git-version"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ad568aa3db0fcbc81f2f116137f263d7304f512a1209b35b85150d3ef88ad19"
|
||||
dependencies = [
|
||||
"git-version-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "git-version-macro"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53010ccb100b96a67bc32c0175f0ed1426b31b655d562898e57325f81c023ac0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gloo-timers"
|
||||
version = "0.3.0"
|
||||
|
|
|
@ -8,6 +8,7 @@ default-run = "authelia-controller"
|
|||
color-eyre = "0.6.3"
|
||||
dotenvy = "0.15.7"
|
||||
futures-util = "0.3.31"
|
||||
git-version = "0.3.9"
|
||||
k8s-openapi = { version = "0.24.0", features = ["v1_31"] }
|
||||
kube = { version = "0.99.0", features = ["derive", "runtime"] }
|
||||
schemars = "0.8.22"
|
||||
|
|
|
@ -13,7 +13,8 @@ COPY --from=planner /app/recipe.json recipe.json
|
|||
RUN cargo chef cook --release --recipe-path recipe.json
|
||||
|
||||
COPY . .
|
||||
ENV RUSTC_BOOTSTRAP=1
|
||||
ARG RELEASE_VERSION
|
||||
ENV RELEASE_VERSION=${RELEASE_VERSION}
|
||||
RUN cargo auditable build --release
|
||||
|
||||
FROM gcr.io/distroless/cc-debian12:nonroot AS runtime
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
#![feature(let_chains)]
|
||||
pub mod context;
|
||||
pub mod resources;
|
||||
mod version;
|
||||
|
||||
pub use version::VERSION;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use authelia_controller::VERSION;
|
||||
use authelia_controller::context::Context;
|
||||
use authelia_controller::resources::AccessControlRule;
|
||||
use color_eyre::eyre::Context as _;
|
||||
|
@ -39,7 +40,7 @@ async fn main() -> color_eyre::Result<()> {
|
|||
})
|
||||
.unwrap_or(Ok(15))?;
|
||||
|
||||
info!("Starting");
|
||||
info!(version = VERSION, "Starting");
|
||||
|
||||
let client = Client::try_default().await?;
|
||||
let access_control_rules = Api::<AccessControlRule>::all(client.clone());
|
||||
|
|
11
src/version.rs
Normal file
11
src/version.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
pub const VERSION: &str = get_version();
|
||||
|
||||
const fn get_version() -> &'static str {
|
||||
if let Some(version) = std::option_env!("RELEASE_VERSION")
|
||||
&& !version.is_empty()
|
||||
{
|
||||
version
|
||||
} else {
|
||||
git_version::git_version!(fallback = "unknown")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user