Skip to content
Snippets Groups Projects
Verified Commit 0b935998 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

feat: deployment

parent 8ec3b152
No related branches found
No related tags found
No related merge requests found
source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0=" use flake
AWS_PROFILE=schukai AWS_PROFILE=schukai
export AWS_PROFILE
source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0="
use devenv use devenv
...@@ -11,3 +11,6 @@ devenv.local.nix ...@@ -11,3 +11,6 @@ devenv.local.nix
.attach_pid* .attach_pid*
/build/ /build/
dist
\ No newline at end of file
# You can override the included template(s) by including variable overrides image: docker-registry.schukai.com:443/nixos-ci-devenv:latest
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings services:
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings - docker:dind
# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings
# Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence variables:
# The repo name as used in
# https://github.com/nix-community/NUR/blob/master/repos.json
NIXOS_VERSION: "23.05"
NIXPKGS_ALLOW_UNFREE: "1"
NIXPKGS_ALLOW_INSECURE: "1"
DOCKER_DRIVER: overlay2
GIT_DEPTH: 10
stages: stages:
- test - build
sast: - deploy
stage: test
include: before_script:
- template: Security/SAST.gitlab-ci.yml - nix shell nixpkgs#coreutils-full -c mkdir -p /certs/client/
- template: Security/Secret-Detection.gitlab-ci.yml - nix shell nixpkgs#coreutils-full -c ln -fs /etc/ssl/certs/ca-bundle.crt /certs/client/ca.pem
- echo > .env-gitlab-ci
- variables=("HOME=$HOME" "CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME" "CI_REPOSITORY_URL=$CI_REPOSITORY_URL" "GITLAB_TOKEN=$GITLAB_TOKEN" "CI_JOB_TOKEN=$CI_JOB_TOKEN" "GITLAB_USER_EMAIL=$GITLAB_USER_EMAIL" "GITLAB_USER_NAME=\"$GITLAB_USER_NAME\"" "CI_REGISTRY_USER=$CI_REGISTRY_USER" "CI_PROJECT_ID=$CI_PROJECT_ID" "CI_PROJECT_DIR=$CI_PROJECT_DIR" "CI_API_V4_URL=$CI_API_V4_URL" "CI_PROJECT_NAME=$CI_PROJECT_NAME" "CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA"); for var in "${variables[@]}"; do echo "$var" >> .env-gitlab-ci; done
- cat .env-gitlab-ci
after_script:
- if [ -f .env-gitlab-ci ]; then rm .env-gitlab-ci; fi
build:
stage: build
tags:
- nixos
script:
- devenv shell build-app
cache:
- key: nixos
paths:
- /nix/store
artifacts:
paths:
- dist
deploy:
stage: deploy
tags:
- nixos
script:
- devenv shell -c deploy-app
when: on_success
cache:
- key: nixos
paths:
- /nix/store
artifacts:
paths:
- dist
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.devenv" /> <excludeFolder url="file://$MODULE_DIR$/.devenv" />
<excludeFolder url="file://$MODULE_DIR$/.direnv" /> <excludeFolder url="file://$MODULE_DIR$/.direnv" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
......
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
PROJECT_ROOT:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)/
THIS_MAKEFILE:=$(PROJECT_ROOT)$(THIS_MAKEFILE_PATH)
GO:=go
BUILD_PATH:=$(PROJECT_ROOT)build/
info:
echo "PROJECT_ROOT: $(PROJECT_ROOT)"
## Compiling for every OS and Platform
compile:
version patch --path $(PROJECT_ROOT)version.json --selector "version"
$(eval VERSION := $(shell cat version.json | jq -r .version))
$(eval BUILD := $(shell version date))
echo "Compiling for every OS and Platform $(VERSION) $(BUILD)"
cd $(PROJECT_ROOT); GOOS=linux GOARCH=arm $(GO) build -ldflags "-X main.version=$(VERSION) -X main.build='$(BUILD)'" -o $(BUILD_PATH)version-linux-arm; cd -
cd $(PROJECT_ROOT); GOOS=linux GOARCH=amd64 $(GO) build -ldflags "-X main.version=$(VERSION) -X main.build='$(BUILD)'" -o $(BUILD_PATH)version-linux-amd64; cd -
cd $(PROJECT_ROOT); GOOS=linux GOARCH=arm64 $(GO) build -ldflags "-X main.version=$(VERSION) -X main.build='$(BUILD)'" -o $(BUILD_PATH)version-linux-arm64; cd -
cd $(PROJECT_ROOT); GOOS=linux GOARCH=386 $(GO) build -ldflags "-X main.version=$(VERSION) -X main.build='$(BUILD)'" -o $(BUILD_PATH)version-linux-386; cd -
cd $(PROJECT_ROOT); GOOS=windows GOARCH=amd64 $(GO) build -ldflags "-X main.version=$(VERSION) -X main.build='$(BUILD)'" -o $(BUILD_PATH)version-windows; cd -
## compile and deplay to aws
deploy: compile
find $(BUILD_PATH) -iname "version-*" -exec aws s3 cp {} s3://download.schukai.com/tools/version/ \;
## overview-to-aws
overview-to-aws:
aws s3 cp $(PROJECT_ROOT)/data/index.html s3://download.schukai.com/tools/version/
\ No newline at end of file
version: '3'
tasks:
default:
aliases:
- help
cmds:
- task --list
build:
desc: Build the app
aliases:
- b
vars:
DEVENV_ROOT:
sh: echo "$DEVENV_ROOT"
cmds:
- devenv shell build-app
sources:
- source/**/*.go
- source/**/*.mod
- dist/**
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
{ pkgs, inputs, phps, lib, config, modulesPath,... }: { pkgs, inputs, phps, lib, config, modulesPath,... }:
{ {
env.LD_LIBRARY_PATH = lib.makeLibraryPath [ ];
env.APP_NAME = "version";
# https://devenv.sh/packages/ # https://devenv.sh/packages/
packages = [ packages = [
inputs.version.defaultPackage."${builtins.currentSystem}" inputs.version.defaultPackage."${builtins.currentSystem}"
...@@ -13,6 +18,9 @@ ...@@ -13,6 +18,9 @@
pkgs.jq pkgs.jq
pkgs.delve pkgs.delve
pkgs.gdlv pkgs.gdlv
pkgs.wget
pkgs.glab
pkgs.unixtools.xxd
pkgs.libffi pkgs.libffi
pkgs.zlib pkgs.zlib
pkgs.procps pkgs.procps
...@@ -20,22 +28,161 @@ ...@@ -20,22 +28,161 @@
pkgs.ranger pkgs.ranger
pkgs.meld pkgs.meld
pkgs.gnused pkgs.gnused
pkgs.coreutils-full # # https://search.nixos.org/packages?channel=23.05&show=coreutils-full&from=0&size=50&sort=relevance&type=packages&query=mkdir pkgs.coreutils-full
pkgs.gnugrep pkgs.gnugrep
pkgs.gnumake pkgs.gnumake
pkgs.util-linux pkgs.util-linux
pkgs.httpie pkgs.httpie
pkgs.netcat pkgs.netcat
pkgs.memcached pkgs.memcached
pkgs.fd pkgs.fd
]; ];
# https://devenv.sh/languages/
# languages.nix.enable = true;
languages = { languages = {
go = { go = { enable = true; };
enable = true;
};
}; };
difftastic.enable = true;
# This script is executed when the app is built
# You can use it to build the app
scripts.build-app.exec = ''
#!${pkgs.bash}/bin/bash
#set -euo pipefail
set -x
} PATH="''${PATH}":${pkgs.coreutils}/bin
PATH="''${PATH}":${pkgs.findutils}/bin
PATH="''${PATH}":${pkgs.jq}/bin/
PATH="''${PATH}":${pkgs.rsync}/bin/
PATH="''${PATH}":${pkgs.bash}/bin/
PATH="''${PATH}":${pkgs.curl}/bin/
PATH="''${PATH}":${pkgs.moreutils}/bin/
PATH="''${PATH}":${pkgs.gnutar}/bin
PATH="''${PATH}":${pkgs.gzip}/bin/
PATH="''${PATH}":${pkgs.procps}/bin/
PATH="''${PATH}":${pkgs.exa}/bin/
PATH="''${PATH}":${pkgs.git}/bin/
PATH="''${PATH}":${pkgs.gnugrep}/bin/
PATH="''${PATH}":${inputs.version.defaultPackage."${builtins.currentSystem}"}/bin/
export -f PATH
if [ -z "'CI_JOB_TOKEN" ]; then
version=''$(git describe --tags --always --dirty)
buildDate=''$(date -u +"%Y-%m-%dT%H:%M:%SZ")
else
version=''$(version predict)
buildDate=''$(version date)
fi
${config.devenv.root}/bin/go-compile.sh \
"${config.devenv.root}/source/" \
"${config.devenv.root}/dist"/ \
"bob" \
"main" \
"''${version}" \
"''${buildDate}"
'';
# This scritp is used to deploy the app to the gitlab registry
# It is used by the gitlab-ci.yml file
# The environment variables are set in the gitlab project settings
scripts.deploy-app.exec = ''
#!${pkgs.bash}/bin/bash
PATH="''${PATH}":${pkgs.coreutils}/bin
PATH="''${PATH}":${pkgs.jq}/bin/
PATH="''${PATH}":${pkgs.curl}/bin/
PATH="''${PATH}":${pkgs.moreutils}/bin/
PATH="''${PATH}":${pkgs.gnutar}/bin
PATH="''${PATH}":${pkgs.gzip}/bin/
PATH="''${PATH}":${pkgs.exa}/bin/
PATH="''${PATH}":${pkgs.git}/bin/
PATH="''${PATH}":${inputs.version.defaultPackage."${builtins.currentSystem}"}/bin/
export -f PATH
if [[ -f .env-gitlab-ci ]]; then
source .env-gitlab-ci
rm .env-gitlab-ci
fi
set -x
## if $HOME not set, set it to current directory
if [[ -z "''${HOME}" ]]; then
HOME=$(pwd)
fi
export HOME
git config user.email "''${GITLAB_USER_EMAIL}"
git config user.name "''${GITLAB_USER_NAME:-"Gitlab CI"}"
git config pull.rebase true
git config http.sslVerify "false"
git remote set-url origin https://pad:''${GITLAB_TOKEN}@''${CI_REPOSITORY_URL#*@}
git fetch --all --tags --unshallow
git reset --hard origin/master
git checkout $CI_COMMIT_REF_NAME
git pull origin $CI_COMMIT_REF_NAME
if [ ! -z "''${CI_PROJECT_DIR}" ]; then
echo "CI_PROJECT_DIR is set, using it as project root."
project_root=$(realpath "''${CI_PROJECT_DIR}")/
elif [ ! -z "''${DEVENV_ROOT}" ]; then
echo "DEVENV_ROOT is set, using it as project root."
project_root=$(realpath "''${DEVENV_ROOT}")/
else
echo "Error: DEVENV_ROOT or CI_PROJECT_DIR environment variables are not set."
exit 1
fi
if [ ! -d "''${project_root}" ]; then
echo "Error: Project root directory does not seem to be valid."
echo "Check the DEVENV_ROOT or CI_PROJECT_DIR environment variables."
exit 1
fi
if [ -z "'CI_JOB_TOKEN" ]; then
echo "Error: CI_JOB_TOKEN variable is not set."
exit 1
fi
git --no-pager log --decorate=short --pretty=oneline
## the version should be the same as in the build task
if ! version auto --git --verbose
then
echo "ERROR: Could not update version."
exit 1
fi
git --no-pager log --decorate=short --pretty=oneline
gitVersion=$(version print --git)
for file in $(exa "''${project_root}"dist/*); do
filname=$(basename ''${file})
curl -v --insecure -H "JOB-TOKEN: ''${CI_JOB_TOKEN}" --upload-file \
''${file} \
https://gitlab.schukai.com/api/v4/projects/''${CI_PROJECT_ID}/packages/generic/${config.env.APP_NAME}/''${gitVersion}/''${filname}
done
git push -o ci.skip origin ''${CI_COMMIT_REF_NAME} --tags
echo "done"
'';
}
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
version = pversion; version = pversion;
# In 'nix develop', we don't need a copy of the source tree # In 'nix develop', we don't need a copy of the source tree
# in the Nix store. # in the Nix store.
src = ./.; src = ././source;
# This hash locks the dependencies of this package. It is # This hash locks the dependencies of this package. It is
# necessary because of how Go requires network access to resolve # necessary because of how Go requires network access to resolve
......
{"version":"0.4.0"}
...@@ -36,6 +36,8 @@ type commandLineOptions struct { ...@@ -36,6 +36,8 @@ type commandLineOptions struct {
} `command:"predict" description:"predict the next version based on the git history. This implies --git"` } `command:"predict" description:"predict the next version based on the git history. This implies --git"`
Print struct { Print struct {
} `command:"print" description:"print the current version, you can combine this with --git to print the last tag"` } `command:"print" description:"print the current version, you can combine this with --git to print the last tag"`
Version struct {
} `command:"version" description:"print the version of this tool"`
} }
func increasePatch() (string, error) { func increasePatch() (string, error) {
...@@ -103,6 +105,11 @@ func executeCommand() { ...@@ -103,6 +105,11 @@ func executeCommand() {
nullTerminated = true nullTerminated = true
} }
if command == "version" {
fmt.Println(GetMnemonic() + " " + GetVersion() + " (" + GetBuild() + ")")
return
}
if command == "predict" { if command == "predict" {
predict = true predict = true
} }
......
File moved
...@@ -7,10 +7,11 @@ import ( ...@@ -7,10 +7,11 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object" "github.com/go-git/go-git/v5/plumbing/object"
"github.com/go-git/go-git/v5/plumbing/storer" "github.com/go-git/go-git/v5/plumbing/storer"
"github.com/go-git/go-git/v5"
) )
var versionRegex = regexp.MustCompile(`^v?(\d+)\.(\d+)\.(\d+).*$`) var versionRegex = regexp.MustCompile(`^v?(\d+)\.(\d+)\.(\d+).*$`)
......
...@@ -4,9 +4,9 @@ go 1.18 ...@@ -4,9 +4,9 @@ go 1.18
require ( require (
github.com/Masterminds/semver v1.5.0 github.com/Masterminds/semver v1.5.0
github.com/go-git/go-git/v5 v5.7.0 github.com/go-git/go-git/v5 v5.8.1
github.com/jessevdk/go-flags v1.5.0 github.com/jessevdk/go-flags v1.5.0
github.com/tidwall/gjson v1.14.4 github.com/tidwall/gjson v1.15.0
github.com/tidwall/sjson v1.2.5 github.com/tidwall/sjson v1.2.5
github.com/vmware-labs/yaml-jsonpath v0.3.2 github.com/vmware-labs/yaml-jsonpath v0.3.2
golang.org/x/text v0.11.0 golang.org/x/text v0.11.0
...@@ -14,8 +14,9 @@ require ( ...@@ -14,8 +14,9 @@ require (
) )
require ( require (
dario.cat/mergo v1.0.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230710112148-e01326fd72eb // indirect github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect
github.com/acomagu/bufpipe v1.0.4 // indirect github.com/acomagu/bufpipe v1.0.4 // indirect
github.com/cloudflare/circl v1.3.3 // indirect github.com/cloudflare/circl v1.3.3 // indirect
github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect
......
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
...@@ -13,6 +15,8 @@ github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903 h1:ZK3C5DtzV2 ...@@ -13,6 +15,8 @@ github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903 h1:ZK3C5DtzV2
github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903/go.mod h1:8TI4H3IbrackdNgv+92dI+rhpCaLqM0IfpgCgenFvRE= github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903/go.mod h1:8TI4H3IbrackdNgv+92dI+rhpCaLqM0IfpgCgenFvRE=
github.com/ProtonMail/go-crypto v0.0.0-20230710112148-e01326fd72eb h1:RU+Ff2vE68zFQSoBqlb/LChFztEWWJ9EZ8LU4gA3ubU= github.com/ProtonMail/go-crypto v0.0.0-20230710112148-e01326fd72eb h1:RU+Ff2vE68zFQSoBqlb/LChFztEWWJ9EZ8LU4gA3ubU=
github.com/ProtonMail/go-crypto v0.0.0-20230710112148-e01326fd72eb/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/ProtonMail/go-crypto v0.0.0-20230710112148-e01326fd72eb/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 h1:KLq8BE0KwCL+mmXnjLWEAOYO+2l2AE4YMmqG1ZpZHBs=
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ= github.com/acomagu/bufpipe v1.0.4 h1:e3H4WUzM3npvo5uv95QuJM3cQspFNtFBzvJ2oNjKIDQ=
...@@ -58,6 +62,8 @@ github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY ...@@ -58,6 +62,8 @@ github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY
github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc=
github.com/go-git/go-git/v5 v5.7.0 h1:t9AudWVLmqzlo+4bqdf7GY+46SUuRsx59SboFxkq2aE= github.com/go-git/go-git/v5 v5.7.0 h1:t9AudWVLmqzlo+4bqdf7GY+46SUuRsx59SboFxkq2aE=
github.com/go-git/go-git/v5 v5.7.0/go.mod h1:coJHKEOk5kUClpsNlXrUvPrDxY3w3gjHvhcZd8Fodw8= github.com/go-git/go-git/v5 v5.7.0/go.mod h1:coJHKEOk5kUClpsNlXrUvPrDxY3w3gjHvhcZd8Fodw8=
github.com/go-git/go-git/v5 v5.8.1 h1:Zo79E4p7TRk0xoRgMq0RShiTHGKcKI4+DI6BfJc/Q+A=
github.com/go-git/go-git/v5 v5.8.1/go.mod h1:FHFuoD6yGz5OSKEBK+aWN9Oah0q54Jxl0abmj6GnqAo=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
...@@ -148,6 +154,8 @@ github.com/tidwall/gjson v1.14.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vl ...@@ -148,6 +154,8 @@ github.com/tidwall/gjson v1.14.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vl
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM= github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM=
github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.15.0 h1:5n/pM+v3r5ujuNl4YLZLsQ+UE5jlkLVm7jMzT5Mpolw=
github.com/tidwall/gjson v1.15.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
......
...@@ -4,12 +4,7 @@ import ( ...@@ -4,12 +4,7 @@ import (
"golang.org/x/text/message" "golang.org/x/text/message"
) )
// Wird beim Bauen per
// -ldflags "-X main.version=$app_version -X main.build=$(due --iso-8601 | tr -d "-" )"
// gesetzt
var ( var (
version string
build string
printer *message.Printer printer *message.Printer
) )
......
package main
// Used when building per
// -ldflags "-X main.version=$version -X main.build=$(due --iso-8601 | tr -d "-" )"
var (
version = "dev"
build = "n/a"
mnemonic = "version"
)
type Accessor interface {
GetVersion() string
GetBuild() string
GetMnemonic() string
}
type ReleaseStruct struct {
Version string
Build string
Mnemonic string
}
var release ReleaseStruct
func init() {
release = ReleaseStruct{
Version: version,
Build: build,
Mnemonic: mnemonic,
}
}
func GetVersion() string {
return release.Version
}
func GetBuild() string {
return release.Build
}
func GetMnemonic() string {
return release.Mnemonic
}
...@@ -3,7 +3,6 @@ package main ...@@ -3,7 +3,6 @@ package main
import ( import (
"bufio" "bufio"
"fmt" "fmt"
"github.com/go-git/go-git/v5"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
...@@ -13,10 +12,11 @@ import ( ...@@ -13,10 +12,11 @@ import (
"github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath" "github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath"
"gopkg.in/yaml.v3"
"github.com/Masterminds/semver" "github.com/Masterminds/semver"
"github.com/go-git/go-git/v5"
"github.com/tidwall/gjson" "github.com/tidwall/gjson"
"gopkg.in/yaml.v3"
) )
var ( var (
......
{
"version": "1.0.33"
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment