Skip to content

Commit

Permalink
Merge pull request #125 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 6.2.0
  • Loading branch information
andyone authored Feb 5, 2023
2 parents a4a71c1 + 2cc12a8 commit 3c86fc6
Show file tree
Hide file tree
Showing 37 changed files with 91 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

strategy:
matrix:
go: [ '1.18.x', '1.19.x' ]
go: [ '1.19.x', '1.20.x' ]

steps:
- name: Set up Go
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.18.x'
go-version: '1.19.x'

- name: Checkout
uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ jobs:
- name: Build and push Docker images (Docker)
if: ${{ steps.build_check.outputs.build == 'true' }}
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
push: true
context: .
Expand All @@ -160,7 +160,7 @@ jobs:

- name: Build and push Docker images (GHCR)
if: ${{ steps.build_check.outputs.build == 'true' }}
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
push: true
context: .
Expand Down
2 changes: 2 additions & 0 deletions COOKBOOK.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,9 @@ Also, there are some run-time variables:
| `DATE` | Current date |
| `HOSTNAME` | Hostname |
| `IP` | Host IP |
| `OS` | OS name (_linux/darwin/freebsd…_) |
| `ARCH` | System architecture (_i386/i686/x86_64/arm…_) |
| `ARCH_NAME` | System architecture name (_386/686/amd64/arm…_) |
| `ARCH_BITS` | System architecture (_32/64_) |
| `LIBDIR` | Path to directory with shared libraries |
| `PYTHON_SITELIB`<br/>`PYTHON2_SITELIB` | Path to directory where pure Python 2 modules are installed (`/usr/lib/python2.X/site-packages`) |
Expand Down
2 changes: 1 addition & 1 deletion action/auxi.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package action

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion action/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package action

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion action/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package action

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion action/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package action

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion action/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package action

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion action/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package action

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion action/libs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package action

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion action/python.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package action

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion action/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package action

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion action/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package action

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion action/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package action

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion bibop.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package main

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
4 changes: 2 additions & 2 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cli

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down Expand Up @@ -38,7 +38,7 @@ import (
// Application info
const (
APP = "bibop"
VER = "6.1.1"
VER = "6.2.0"
DESC = "Utility for testing command-line tools"
)

Expand Down
2 changes: 1 addition & 1 deletion cli/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package executor

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion cli/executor/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package executor

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/buger/jsonparser v1.1.1
github.com/essentialkaos/check v1.3.0
github.com/essentialkaos/depsy v1.0.0
github.com/essentialkaos/ek/v12 v12.57.1
github.com/essentialkaos/ek/v12 v12.58.0
github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ github.com/essentialkaos/check v1.3.0 h1:ria+8o22RCLdt2D/1SHQsEH5Mmy5S+iWHaGHrrb
github.com/essentialkaos/check v1.3.0/go.mod h1:PhxzfJWlf5L/skuyhzBLIvjMB5Xu9TIyDIsqpY5MvB8=
github.com/essentialkaos/depsy v1.0.0 h1:FikBtTnNhk+xFO/hFr+CfiKs6QnA3wMD6tGL0XTEUkc=
github.com/essentialkaos/depsy v1.0.0/go.mod h1:XVsB2eVUonEzmLKQP3ig2P6v2+WcHVgJ10zm0JLqFMM=
github.com/essentialkaos/ek/v12 v12.57.1 h1:9dj32HLCVmseBoa43F6HaZz1qbKts5GNBCtFdrpQPno=
github.com/essentialkaos/ek/v12 v12.57.1/go.mod h1:G8ghiSKh8ToJQCdB2bAhE3CnI6dn9nTJdWH3bQIVr1U=
github.com/essentialkaos/ek/v12 v12.58.0 h1:k0HIBV4w0te4Yr/j5apowXvq1tLP3kbmZdyvxP4YkN0=
github.com/essentialkaos/ek/v12 v12.58.0/go.mod h1:G8ghiSKh8ToJQCdB2bAhE3CnI6dn9nTJdWH3bQIVr1U=
github.com/essentialkaos/go-linenoise/v3 v3.4.0/go.mod h1:t1kNLY2bSMQCy1JXOefD2BDLs/TTPMtTv3DFNV5uDSI=
github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2 h1:CVuJwN34x4xM2aT4sIKhmeib40NeBPhRihNjQmpJsA4=
github.com/google/goterm v0.0.0-20200907032337-555d40f16ae2/go.mod h1:nOFQdrUlIlx6M6ODdSpBj1NVA+VgLC6kmw60mkw34H4=
Expand Down
2 changes: 1 addition & 1 deletion parser/fuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package parser

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package parser

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package parser

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
2 changes: 1 addition & 1 deletion recipe/recipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package recipe

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
4 changes: 3 additions & 1 deletion recipe/recipe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package recipe

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down Expand Up @@ -201,7 +201,9 @@ func (s *RecipeSuite) TestDynamicVariables(c *C) {
c.Assert(r.GetVariable("HOSTNAME"), Not(Equals), "")
c.Assert(r.GetVariable("IP"), Not(Equals), "")
c.Assert(r.GetVariable("ARCH"), Not(Equals), "")
c.Assert(r.GetVariable("ARCH_NAME"), Not(Equals), "")
c.Assert(r.GetVariable("ARCH_BITS"), Not(Equals), "")
c.Assert(r.GetVariable("OS"), Not(Equals), "")

c.Assert(r.GetVariable("LIBDIR"), Not(Equals), "")

Expand Down
44 changes: 37 additions & 7 deletions recipe/runtime_variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package recipe

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down Expand Up @@ -30,6 +30,8 @@ var DynamicVariables = []string{
"IP",
"ARCH",
"ARCH_BITS",
"ARCH_NAME",
"OS",
"PYTHON_SITELIB",
"PYTHON2_SITELIB",
"PYTHON_SITEARCH",
Expand All @@ -50,6 +52,9 @@ var DynamicVariables = []string{
// dynVarCache is dynamic variables cache
var dynVarCache map[string]string

// systemInfoCache is cached system info
var systemInfoCache *system.SystemInfo

// prefixDir is path to base prefix dir
var prefixDir = "/usr"

Expand Down Expand Up @@ -88,26 +93,40 @@ func getRuntimeVariable(name string, r *Recipe) string {
return time.Now().String()

case "HOSTNAME":
systemInfo, err := system.GetSystemInfo()
systemInfo := getSystemInfo()

if err == nil {
if systemInfo != nil {
dynVarCache[name] = systemInfo.Hostname
}

case "ARCH":
systemInfo, err := system.GetSystemInfo()
systemInfo := getSystemInfo()

if err == nil {
if systemInfo != nil {
dynVarCache[name] = systemInfo.Arch
}

case "ARCH_BITS":
systemInfo, err := system.GetSystemInfo()
systemInfo := getSystemInfo()

if err == nil {
if systemInfo != nil {
dynVarCache[name] = strconv.Itoa(systemInfo.ArchBits)
}

case "ARCH_NAME":
systemInfo := getSystemInfo()

if systemInfo != nil {
dynVarCache[name] = systemInfo.ArchName
}

case "OS":
systemInfo := getSystemInfo()

if systemInfo != nil {
dynVarCache[name] = strings.ToLower(systemInfo.OS)
}

case "IP":
dynVarCache[name] = netutil.GetIP()

Expand Down Expand Up @@ -148,6 +167,17 @@ func getRuntimeVariable(name string, r *Recipe) string {
return dynVarCache[name]
}

// getSystemInfo returns struct with system info
func getSystemInfo() *system.SystemInfo {
if systemInfoCache != nil {
return systemInfoCache
}

systemInfoCache, _ = system.GetSystemInfo()

return systemInfoCache
}

// getPythonSitePackages return path Python site packages directory
func getPythonSitePackages(version string, arch, local bool) string {
prefix := getPrefixDir(local)
Expand Down
2 changes: 1 addition & 1 deletion recipe/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package recipe

// ////////////////////////////////////////////////////////////////////////////////// //
// //
// Copyright (c) 2022 ESSENTIAL KAOS //
// Copyright (c) 2023 ESSENTIAL KAOS //
// Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0> //
// //
// ////////////////////////////////////////////////////////////////////////////////// //
Expand Down
Loading

0 comments on commit 3c86fc6

Please sign in to comment.