Add DISTRO_ID_LIKE environment variable
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Arsen Musayelyan 2022-11-21 21:03:56 -08:00
parent d941ce231e
commit 5bc81e3a30
2 changed files with 11 additions and 0 deletions

View File

@ -22,6 +22,7 @@ import (
"bytes"
"context"
"encoding/hex"
"fmt"
"io"
"os"
"path/filepath"
@ -122,6 +123,9 @@ func buildPackage(ctx context.Context, script string, mgr manager.Manager) ([]st
var distroChanged bool
if distID, ok := os.LookupEnv("LURE_DISTRO"); ok {
info.ID = distID
// Since the distro was overwritten, we don't know what the
// like distros are, so set to nil
info.Like = nil
distroChanged = true
}
@ -479,6 +483,7 @@ func genBuildEnv(info *distro.OSRelease) []string {
"DISTRO_PRETTY_NAME="+info.PrettyName,
"DISTRO_ID="+info.ID,
"DISTRO_VERSION_ID="+info.VersionID,
"DISTRO_ID_LIKE="+strings.Join(info.Like, " "),
"ARCH="+arch,
"NCPU="+strconv.Itoa(runtime.NumCPU()),

View File

@ -301,6 +301,12 @@ The `DISTRO_ID` variable is the identifier of the distro as defined in its `os-r
For example, it's set to `fedora` in a Fedora 36 docker image
### DISTRO_ID_LIKE
The `DISTRO_ID_LIKE` variable contains identifiers of similar distros to the one running, separated by spaces.
For example, it's set to `opensuse suse` in an OpenSUSE Tumbleweed docker image and `rhel fedora` in a CentOS 8 docker image.
### DISTRO_VERSION_ID
The `DISTRO_VERSION_ID` variable is the version identifier of the distro as defined in its `os-release` file.