-
Notifications
You must be signed in to change notification settings - Fork 550
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Toolkit: Use systemd-detect-virt instead of /.dockerenv to detect con…
…tainer builds. (#11039)
- Loading branch information
1 parent
2a82335
commit 1159d26
Showing
7 changed files
with
184 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ sudo tdnf -y install \ | |
rpm \ | ||
rpm-build \ | ||
sudo \ | ||
systemd \ | ||
tar \ | ||
wget \ | ||
xfsprogs \ | ||
|
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 |
---|---|---|
|
@@ -23,6 +23,7 @@ sudo apt -y install \ | |
parted \ | ||
pigz \ | ||
openssl \ | ||
systemd \ | ||
qemu-utils \ | ||
rpm \ | ||
tar \ | ||
|
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,33 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
// Returns true (exit code 0) if the current build is a container build, false (exit code 1) otherwise | ||
|
||
package main | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/microsoft/azurelinux/toolkit/tools/internal/buildpipeline" | ||
"github.com/microsoft/azurelinux/toolkit/tools/internal/exe" | ||
"github.com/microsoft/azurelinux/toolkit/tools/internal/logger" | ||
|
||
"gopkg.in/alecthomas/kingpin.v2" | ||
) | ||
|
||
var ( | ||
app = kingpin.New("containercheck", "Returns true (0) if the current build is a container build, false (1) otherwise") | ||
logFlags = exe.SetupLogFlags(app) | ||
) | ||
|
||
func main() { | ||
app.Version(exe.ToolkitVersion) | ||
kingpin.MustParse(app.Parse(os.Args[1:])) | ||
logger.InitBestEffort(logFlags) | ||
|
||
if buildpipeline.IsRegularBuild() { | ||
os.Exit(1) | ||
} else { | ||
os.Exit(0) | ||
} | ||
} |
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