From 4cf4ff4942034ac8c05cdbc8f5ff6e42affd458c Mon Sep 17 00:00:00 2001 From: Bruno Felipe Leal Delfino Date: Sun, 5 Feb 2023 04:10:56 -0300 Subject: [PATCH] Release v0.6.0 --- .github/actions/cache/action.yml | 15 +++++++----- .github/workflows/base.yml | 24 ++++++++++---------- .github/workflows/lints.yml | 32 ++++++++++++++------------ .github/workflows/release.yml | 39 ++++++++++++++++++++------------ CHANGELOG.md | 8 +++---- Cargo.lock | 14 ++++++------ Cargo.toml | 14 ++++++------ Justfile | 6 ++--- README.md | 7 +++--- bin/src/compile/mod.rs | 7 +++--- bin/src/main.rs | 3 ++- docs/index.md | 6 ----- 12 files changed, 94 insertions(+), 81 deletions(-) diff --git a/.github/actions/cache/action.yml b/.github/actions/cache/action.yml index b74adc0..3425bfc 100644 --- a/.github/actions/cache/action.yml +++ b/.github/actions/cache/action.yml @@ -1,6 +1,9 @@ name: Cache inputs: + rustc: + description: Rustc version hash + required: true variant: description: Variant to distinguish different caches default: 'default' @@ -32,9 +35,9 @@ runs: ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + key: ${{ runner.os }}-${{ inputs.rustc }}-cargo-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - ${{ runner.os }}-cargo + ${{ runner.os }}-${{ inputs.rustc }}-cargo - name: Restore compiled dependencies id: compiled @@ -42,10 +45,10 @@ runs: uses: actions/cache/restore@v3 with: path: target/ - key: ${{ runner.os }}-cargo-${{ inputs.variant }}-${{ hashFiles('**/Cargo.lock') }} + key: ${{ runner.os }}-${{ inputs.rustc }}-cargo-${{ inputs.variant }}-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - ${{ runner.os }}-cargo-${{ inputs.variant }} - ${{ runner.os }}-cargo-default + ${{ runner.os }}-${{ inputs.rustc }}-cargo-${{ inputs.variant }} + ${{ runner.os }}-${{ inputs.rustc }}-cargo-default - name: Configure cleanup before cache save if: inputs.compiled == 'save' @@ -59,4 +62,4 @@ runs: uses: actions/cache/save@v3 with: path: target/ - key: ${{ runner.os }}-cargo-${{ inputs.variant }}-${{ hashFiles('**/Cargo.lock') }} + key: ${{ runner.os }}-${{ inputs.rustc }}-cargo-${{ inputs.variant }}-${{ hashFiles('**/Cargo.lock') }} diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 9ab67fa..5ed8ae3 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -10,11 +10,8 @@ jobs: - name: Checkout sources uses: actions/checkout@v3 - - name: Configure cache - id: cache - uses: ./.github/actions/cache - - name: Install toolchain + id: toolchain uses: actions-rs/toolchain@v1 with: profile: minimal @@ -22,6 +19,12 @@ jobs: override: true components: rustfmt, clippy, llvm-tools + - name: Configure cache + id: cache + uses: ./.github/actions/cache + with: + rustc: ${{ steps.toolchain.outputs.rustc_hash }} + - name: Compile project if: steps.cache.outputs.compiled != 'true' uses: actions-rs/cargo@v1 @@ -30,20 +33,17 @@ jobs: - name: Install coverage tool if: steps.cache.outputs.index != 'true' - uses: actions-rs/cargo@v1 - with: - command: install - args: grcov + shell: bash + run: which grcov || cargo install grcov - name: Install cross compiler if: steps.cache.outputs.index != 'true' - uses: actions-rs/cargo@v1 - with: - command: install - args: cross + shell: bash + run: which cross || cargo install cross - name: Save cache if: steps.cache.outputs.compiled != 'true' uses: ./.github/actions/cache with: + rustc: ${{ steps.toolchain.outputs.rustc_hash }} compiled: save diff --git a/.github/workflows/lints.yml b/.github/workflows/lints.yml index e8d0a0b..198387c 100644 --- a/.github/workflows/lints.yml +++ b/.github/workflows/lints.yml @@ -18,14 +18,8 @@ jobs: - name: Checkout sources uses: actions/checkout@v3 - - name: Restore cache - id: cache - uses: ./.github/actions/cache - with: - variant: coverage - compiled: restore - - name: Install toolchain + id: toolchain uses: actions-rs/toolchain@v1 with: profile: minimal @@ -33,6 +27,14 @@ jobs: override: true components: llvm-tools + - name: Restore cache + id: cache + uses: ./.github/actions/cache + with: + rustc: ${{ steps.toolchain.outputs.rustc_hash }} + variant: coverage + compiled: restore + - name: Run tests uses: actions-rs/cargo@v1 env: @@ -45,10 +47,8 @@ jobs: - name: Install coverage tool if: steps.cache.outputs.index != 'true' - uses: actions-rs/cargo@v1 - with: - command: install - args: grcov + shell: bash + run: which grcov || cargo install grcov - name: Generate coverage report shell: bash @@ -66,6 +66,7 @@ jobs: - name: Save cache uses: ./.github/actions/cache with: + rustc: ${{ steps.toolchain.outputs.rustc_hash }} variant: coverage compiled: save @@ -77,10 +78,8 @@ jobs: - name: Checkout sources uses: actions/checkout@v3 - - name: Configure cache - uses: ./.github/actions/cache - - name: Install toolchain + id: toolchain uses: actions-rs/toolchain@v1 with: profile: minimal @@ -88,6 +87,11 @@ jobs: override: true components: rustfmt, clippy + - name: Configure cache + uses: ./.github/actions/cache + with: + rustc: ${{ steps.toolchain.outputs.rustc_hash }} + - name: Run cargo fmt uses: actions-rs/cargo@v1 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6fd28e6..6182967 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,16 +39,19 @@ jobs: - name: Checkout sources uses: actions/checkout@v3 - - name: Restore cache - uses: ./.github/actions/cache - - name: Install toolchain + id: toolchain uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable override: true + - name: Restore cache + uses: ./.github/actions/cache + with: + rustc: ${{ steps.toolchain.outputs.rustc_hash }} + - name: Run tests uses: actions-rs/cargo@v1 with: @@ -121,37 +124,38 @@ jobs: - name: Checkout sources uses: actions/checkout@v3 - - name: Restore cache - id: cache - uses: ./.github/actions/cache - with: - variant: release - compiled: skip - - name: Install toolchain + id: toolchain uses: actions-rs/toolchain@v1 with: + target: ${{ matrix.target }} profile: minimal toolchain: stable override: true + - name: Configure cache + uses: ./.github/actions/cache + with: + rustc: ${{ steps.toolchain.outputs.rustc_hash }} + compiled: skip + - name: Linux x86 cross compiler if: startsWith(matrix.target, 'i686-unknown-linux-') run: sudo apt install gcc-multilib - name: ARM cross compiler if: startsWith(matrix.target, 'aarch64-unknown-linux-') && steps.cache.outputs.index != 'true' - uses: actions-rs/cargo@v1 - with: - command: install - args: cross + shell: bash + run: which cross || cargo install cross - name: ARM gcc if: startsWith(matrix.target, 'aarch64-unknown-linux-') + shell: bash run: sudo apt install gcc-aarch64-linux-gnu - name: Musl gcc if: endsWith(matrix.target, '-musl') + shell: bash run: sudo apt install musl musl-tools - name: Run cross build @@ -173,8 +177,15 @@ jobs: cp ${{ matrix.bin }} ../../../${{ matrix.name }} - name: Generate SHA-256 + if: matrix.os != 'windows-latest' + shell: bash run: shasum -a 256 ${{ matrix.name }} > ${{ matrix.name }}.sha256 + - name: Generate SHA-256 on Windows + if: matrix.os == 'windows-latest' + shell: pwsh + run: Get-FileHash ${{ matrix.name }} -Algorithm SHA256 | Out-File -FilePath ${{ matrix.name }}.sha256 + - name: Publish uses: softprops/action-gh-release@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 601f0d1..d63ebf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.6.0] - 2023-02-05 ### Added @@ -15,7 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - no automatic input for `_.files`, now it gets it from the second parameter -- `_.files` in libsonnet have an optional second parameter to keep the old experience +- optional input parameter for `_.files` to keep the old experience +- optional input parameter for `_.include` for packages without input - separate package crate into compiler and jsonnet crates ### Fixed @@ -27,7 +28,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - package command was removed because its original purpose is now achieved with jsonnet bundler - schema validation for `example.json` - you can compile with it as input to validate it - ## [0.5.0] - 2022-07-01 ### Added @@ -115,7 +115,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - package description from `kcp.json` - "extensibility" guarantees by forbidding non object paths to K8s objects -[Unreleased]: https://github.com/bruno-delfino1995/kct/compare/v0.5.0...HEAD +[0.6.0]: https://github.com/bruno-delfino1995/kct/compare/v0.6.0...v0.5.0 [0.5.0]: https://github.com/bruno-delfino1995/kct/compare/v0.5.0...v0.4.0 [0.4.0]: https://github.com/bruno-delfino1995/kct/compare/v0.4.0...v0.3.1 [0.3.1]: https://github.com/bruno-delfino1995/kct/compare/v0.3.1...v0.2.0 diff --git a/Cargo.lock b/Cargo.lock index 2113dd9..9c04640 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -631,7 +631,7 @@ dependencies = [ [[package]] name = "kct" -version = "0.5.0" +version = "0.6.0" dependencies = [ "anyhow", "clap", @@ -646,7 +646,7 @@ dependencies = [ [[package]] name = "kct_compiler" -version = "0.5.0" +version = "0.6.0" dependencies = [ "anyhow", "kct_jsonnet", @@ -656,7 +656,7 @@ dependencies = [ [[package]] name = "kct_helper" -version = "0.5.0" +version = "0.6.0" dependencies = [ "anyhow", "serde_json", @@ -665,7 +665,7 @@ dependencies = [ [[package]] name = "kct_jsonnet" -version = "0.5.0" +version = "0.6.0" dependencies = [ "anyhow", "jrsonnet-evaluator", @@ -678,7 +678,7 @@ dependencies = [ [[package]] name = "kct_kube" -version = "0.5.0" +version = "0.6.0" dependencies = [ "anyhow", "assert_matches", @@ -692,7 +692,7 @@ dependencies = [ [[package]] name = "kct_package" -version = "0.5.0" +version = "0.6.0" dependencies = [ "anyhow", "assert_matches", @@ -710,7 +710,7 @@ dependencies = [ [[package]] name = "kct_testing" -version = "0.5.0" +version = "0.6.0" dependencies = [ "fs_extra", "kct_package", diff --git a/Cargo.toml b/Cargo.toml index c1f8406..61de608 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ members = [ ] [workspace.package] -version = "0.5.0" +version = "0.6.0" edition = "2021" license = "MIT" authors = ["Bruno Felipe Leal Delfino "] @@ -19,12 +19,12 @@ repository = "https://github.com/bruno-delfino1995/kct" [workspace.dependencies] anyhow = "1.0.68" assert_matches = "1.5.0" -kct_compiler = { path = "./crates/kct_compiler", version = "=0.5.0"} -kct_helper = { path = "./crates/kct_helper", version = "=0.5.0"} -kct_jsonnet = { path = "./crates/kct_jsonnet", version = "=0.5.0"} -kct_kube = { path = "./crates/kct_kube", version = "=0.5.0"} -kct_package = { path = "./crates/kct_package", version = "=0.5.0"} -kct_testing = { path = "./crates/kct_testing", version = "=0.5.0"} +kct_compiler = { path = "./crates/kct_compiler", version = "=0.6.0"} +kct_helper = { path = "./crates/kct_helper", version = "=0.6.0"} +kct_jsonnet = { path = "./crates/kct_jsonnet", version = "=0.6.0"} +kct_kube = { path = "./crates/kct_kube", version = "=0.6.0"} +kct_package = { path = "./crates/kct_package", version = "=0.6.0"} +kct_testing = { path = "./crates/kct_testing", version = "=0.6.0"} serde_json = "1.0.91" serde_yaml = "0.8" tera = "1.17.1" diff --git a/Justfile b/Justfile index 9da6673..b2777e0 100644 --- a/Justfile +++ b/Justfile @@ -46,10 +46,10 @@ release: #!/usr/bin/env bash set -euo pipefail VERSION=$(gum input --placeholder "version") - cargo workspaces version --no-git-commit --exact --yes custom "$VERSION" TAG="v${VERSION}" + git switch main git commit -am "Release $TAG" git tag -sm "Release $TAG" $TAG - git push -u origin HEAD - git push -u origin $TAG + git push origin HEAD + git push origin $TAG diff --git a/README.md b/README.md index bc9a2a4..a4c6fbc 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ # Kubernetes Configuration Tool -![build](https://img.shields.io/github/actions/workflow/status/bruno-delfino1995/kct/lints.yml?branch=main&style=flat-square) -![license](https://img.shields.io/github/license/bruno-delfino1995/kct?style=flat-square) -![version](https://img.shields.io/github/v/release/bruno-delfino1995/kct?style=flat-square) +[![build](https://img.shields.io/github/actions/workflow/status/bruno-delfino1995/kct/lints.yml?branch=main)](https://github.com/bruno-delfino1995/kct/actions/workflows/lints.yml?query=branch%3Amain) +[![license](https://img.shields.io/github/license/bruno-delfino1995/kct)](https://github.com/bruno-delfino1995/kct/blob/main/LICENSE) +[![version](https://img.shields.io/github/v/release/bruno-delfino1995/kct?label=version)](https://github.com/bruno-delfino1995/kct/releases/latest) +[![coverage](https://codecov.io/gh/bruno-delfino1995/kct/branch/main/graph/badge.svg?token=VAXMGX6OKU)](https://codecov.io/gh/bruno-delfino1995/kct) KCT is a tool for taming the Kubernetes configuration beast by using Jsonnet while borrowing approaches and concepts from early contestants such as Tanka and Helm. diff --git a/bin/src/compile/mod.rs b/bin/src/compile/mod.rs index 737cfb4..972ff7b 100644 --- a/bin/src/compile/mod.rs +++ b/bin/src/compile/mod.rs @@ -1,16 +1,15 @@ mod args; -use crate::error::Error; +use self::args::Output; pub use self::args::Args; -use self::args::Output; -use std::convert::TryFrom; +use crate::error::Error; +use std::convert::TryFrom; use std::path::PathBuf; use anyhow::Result; - use kct_compiler::Release; use kct_helper::io::{self, Location}; use kct_helper::json::merge; diff --git a/bin/src/main.rs b/bin/src/main.rs index d1dd684..c04bb58 100644 --- a/bin/src/main.rs +++ b/bin/src/main.rs @@ -1,10 +1,11 @@ mod compile; mod error; -use clap::{Parser, Subcommand}; use std::fmt; use std::process; +use clap::{Parser, Subcommand}; + #[derive(Parser)] #[command( version, diff --git a/docs/index.md b/docs/index.md index b76fe8e..51142d7 100644 --- a/docs/index.md +++ b/docs/index.md @@ -18,12 +18,6 @@ The motivation came from ["The State of Kubernetes Configuration Management: An We want to trust the users with context and cluster access, by using their [preffered tools](https://github.com/ahmetb/kubectx) to manage kubeconfig, while focusing on the creation of the resources with a better templating language. - - -## Roadmap - -We don't have a clear set of features we want to have, but we do have the path we want to take. You can get a glimpse of such path by looking at our [milestones](https://github.com/kseat/kct/milestones). As summary, we're aspiring to be a Helm alternative but with: optional releases, file templating, Jsonnet, build stages, and more. - ## Acknowledgments