-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Final merge from Dev to Master (#344)
* build: make build vars optional and passable via env * build: use . for BUILD_FILES var to allow buildvcs flag * build: create mkbindir, build and sha256 targets * build: reuse build target for each platform specific compilation * Ensure same go version for main and plugins * chore: release 2.3.0 Release-As: 2.3.0 * release-please * Fix(plugins)!: Rename the groups table to ldapgroups (#326) The groups table name is a reserved keyword in mysql and requires that the table name be escaped with backticks in order to use the groups name. Other databases such as postgres do not support the use of the backticks in the query statements. This change renames the groups table to ldapgroups in oder to avoid this problem altogether. This does have a dependency on the backend sql plugins to alter the schema to match the new name. Signed-off-by: Billy Olsen <[email protected]> Co-authored-by: Chris F Ravenscroft <[email protected]> * chore: update docker sqlite with ldapgroups (#338) * feat: Update migration code to support table names (#339) * chore(dev): release 2.3.0 (#337) * ci: change pr name pattern for release please * ci: switch to use master as default branch and plan to drop dev * fix: exploit release-please for tagging in code * fix: use runtime/debug to fetch git build info * fix: use newer function to fetch git info for version * build: drop build tags --------- Signed-off-by: Billy Olsen <[email protected]> Co-authored-by: shipperizer <[email protected]> Co-authored-by: Billy Olsen <[email protected]>
- Loading branch information
1 parent
0904a24
commit 114b36f
Showing
5 changed files
with
82 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package version | ||
|
||
// Version is the tag of the latest release, it gets changed by the ci | ||
// process when a release is happening | ||
const Version = "v2.3.0" // x-release-please-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package version | ||
|
||
import ( | ||
"fmt" | ||
"runtime/debug" | ||
) | ||
|
||
type gitInfo struct { | ||
BuildTime string | ||
Commit string | ||
Dirty bool | ||
} | ||
|
||
// GetVersion reads builtime vars and returns a full string containing info about | ||
// the currently running version of the software. Primarily used by the | ||
// --version flag at runtime. | ||
func GetVersion() string { | ||
|
||
// TODO @shipperizer see if it's worth replacing with info.Main.Path | ||
// aka github.com/glauth/glauth/v2 - not great but worth checking | ||
|
||
name := "GLauth" | ||
|
||
info, ok := debug.ReadBuildInfo() | ||
|
||
if !ok { | ||
return fmt.Sprintf(` | ||
%s | ||
Non-release build`, | ||
name) | ||
} | ||
|
||
gitInfo := vcsInfo(info.Settings) | ||
|
||
// If a release, use the tag | ||
if !gitInfo.Dirty { | ||
return fmt.Sprintf(`%s %s | ||
Build time: %s | ||
Commit: %s`, name, Version, gitInfo.BuildTime, gitInfo.Commit) | ||
} | ||
|
||
return fmt.Sprintf(`%s | ||
Non-release build based on tag %s | ||
Build time: %s | ||
Commit: %s`, name, Version, gitInfo.BuildTime, gitInfo.Commit) | ||
|
||
} | ||
|
||
func vcsInfo(settings []debug.BuildSetting) *gitInfo { | ||
info := new(gitInfo) | ||
|
||
info.BuildTime = "unknown" | ||
info.Commit = "unknown" | ||
info.Dirty = false | ||
|
||
for _, v := range settings { | ||
switch v.Key { | ||
case "vcs.revision": | ||
info.Commit = v.Value | ||
case "vcs.modified": | ||
info.Dirty = v.Value == "true" | ||
case "vcs.time": | ||
info.BuildTime = v.Value | ||
} | ||
} | ||
|
||
return info | ||
} |