Merge pull request #24861 from Luap99/debian-fixes
Some debian test fixes
This commit is contained in:
commit
0642bb1c25
|
@ -16,6 +16,7 @@ import (
|
||||||
"github.com/containers/common/pkg/config"
|
"github.com/containers/common/pkg/config"
|
||||||
"github.com/containers/common/pkg/ssh"
|
"github.com/containers/common/pkg/ssh"
|
||||||
"github.com/containers/image/v5/pkg/sysregistriesv2"
|
"github.com/containers/image/v5/pkg/sysregistriesv2"
|
||||||
|
imageTypes "github.com/containers/image/v5/types"
|
||||||
"github.com/containers/podman/v5/cmd/podman/registry"
|
"github.com/containers/podman/v5/cmd/podman/registry"
|
||||||
"github.com/containers/podman/v5/libpod/define"
|
"github.com/containers/podman/v5/libpod/define"
|
||||||
"github.com/containers/podman/v5/libpod/events"
|
"github.com/containers/podman/v5/libpod/events"
|
||||||
|
@ -276,7 +277,9 @@ func getSecrets(cmd *cobra.Command, toComplete string, cType completeType) ([]st
|
||||||
}
|
}
|
||||||
|
|
||||||
func getRegistries() ([]string, cobra.ShellCompDirective) {
|
func getRegistries() ([]string, cobra.ShellCompDirective) {
|
||||||
regs, err := sysregistriesv2.UnqualifiedSearchRegistries(nil)
|
sysCtx := &imageTypes.SystemContext{}
|
||||||
|
SetRegistriesConfPath(sysCtx)
|
||||||
|
regs, err := sysregistriesv2.UnqualifiedSearchRegistries(sysCtx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
cobra.CompErrorln(err.Error())
|
cobra.CompErrorln(err.Error())
|
||||||
return nil, cobra.ShellCompDirectiveNoFileComp
|
return nil, cobra.ShellCompDirectiveNoFileComp
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/containers/image/v5/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SetRegistriesConfPath sets the registries.conf path for the specified context.
|
||||||
|
// NOTE: this is a verbatim copy from c/common/libimage which we're not using
|
||||||
|
// to prevent leaking c/storage into this file. Maybe this should go into c/image?
|
||||||
|
func SetRegistriesConfPath(systemContext *types.SystemContext) {
|
||||||
|
if systemContext.SystemRegistriesConfPath != "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if envOverride, ok := os.LookupEnv("CONTAINERS_REGISTRIES_CONF"); ok {
|
||||||
|
systemContext.SystemRegistriesConfPath = envOverride
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if envOverride, ok := os.LookupEnv("REGISTRIES_CONFIG_PATH"); ok {
|
||||||
|
systemContext.SystemRegistriesConfPath = envOverride
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
|
@ -98,24 +98,7 @@ func login(cmd *cobra.Command, args []string) error {
|
||||||
sysCtx := &types.SystemContext{
|
sysCtx := &types.SystemContext{
|
||||||
DockerInsecureSkipTLSVerify: skipTLS,
|
DockerInsecureSkipTLSVerify: skipTLS,
|
||||||
}
|
}
|
||||||
setRegistriesConfPath(sysCtx)
|
common.SetRegistriesConfPath(sysCtx)
|
||||||
loginOptions.GetLoginSet = cmd.Flag("get-login").Changed
|
loginOptions.GetLoginSet = cmd.Flag("get-login").Changed
|
||||||
return auth.Login(context.Background(), sysCtx, &loginOptions.LoginOptions, args)
|
return auth.Login(context.Background(), sysCtx, &loginOptions.LoginOptions, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// setRegistriesConfPath sets the registries.conf path for the specified context.
|
|
||||||
// NOTE: this is a verbatim copy from c/common/libimage which we're not using
|
|
||||||
// to prevent leaking c/storage into this file. Maybe this should go into c/image?
|
|
||||||
func setRegistriesConfPath(systemContext *types.SystemContext) {
|
|
||||||
if systemContext.SystemRegistriesConfPath != "" {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if envOverride, ok := os.LookupEnv("CONTAINERS_REGISTRIES_CONF"); ok {
|
|
||||||
systemContext.SystemRegistriesConfPath = envOverride
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if envOverride, ok := os.LookupEnv("REGISTRIES_CONFIG_PATH"); ok {
|
|
||||||
systemContext.SystemRegistriesConfPath = envOverride
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -49,6 +49,6 @@ func init() {
|
||||||
// Implementation of podman-logout.
|
// Implementation of podman-logout.
|
||||||
func logout(cmd *cobra.Command, args []string) error {
|
func logout(cmd *cobra.Command, args []string) error {
|
||||||
sysCtx := &types.SystemContext{}
|
sysCtx := &types.SystemContext{}
|
||||||
setRegistriesConfPath(sysCtx)
|
common.SetRegistriesConfPath(sysCtx)
|
||||||
return auth.Logout(sysCtx, &logoutOptions, args)
|
return auth.Logout(sysCtx, &logoutOptions, args)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -1469,11 +1468,6 @@ func CopyDirectory(srcDir, dest string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
stat, ok := fileInfo.Sys().(*syscall.Stat_t)
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("failed to get raw syscall.Stat_t data for %q", sourcePath)
|
|
||||||
}
|
|
||||||
|
|
||||||
switch fileInfo.Mode() & os.ModeType {
|
switch fileInfo.Mode() & os.ModeType {
|
||||||
case os.ModeDir:
|
case os.ModeDir:
|
||||||
if err := os.MkdirAll(destPath, 0755); err != nil {
|
if err := os.MkdirAll(destPath, 0755); err != nil {
|
||||||
|
@ -1492,10 +1486,6 @@ func CopyDirectory(srcDir, dest string) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := os.Lchown(destPath, int(stat.Uid), int(stat.Gid)); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
fInfo, err := entry.Info()
|
fInfo, err := entry.Info()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -17,12 +17,6 @@ var _ = Describe("podman system dial-stdio", func() {
|
||||||
Expect(session.OutputToString()).To(ContainSubstring("Examples: podman system dial-stdio"))
|
Expect(session.OutputToString()).To(ContainSubstring("Examples: podman system dial-stdio"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman system dial-stdio while service is not running", func() {
|
// TODO: this should have a proper connection test where we spawn a server
|
||||||
if IsRemote() {
|
// and the use dial-stdio to connect to it and send data.
|
||||||
Skip("this test is only for non-remote")
|
|
||||||
}
|
|
||||||
session := podmanTest.Podman([]string{"system", "dial-stdio"})
|
|
||||||
session.WaitWithDefaultTimeout()
|
|
||||||
Expect(session).Should(ExitWithError(125, "Error: failed to open connection to podman"))
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -168,10 +168,10 @@ function check_shell_completion() {
|
||||||
|
|
||||||
*REGISTRY*)
|
*REGISTRY*)
|
||||||
run_completion "$@" $cmd "${extra_args[@]}" ""
|
run_completion "$@" $cmd "${extra_args[@]}" ""
|
||||||
### FIXME how can we get the configured registries?
|
|
||||||
_check_completion_end NoFileComp
|
_check_completion_end NoFileComp
|
||||||
### FIXME this fails if no registries are configured
|
|
||||||
assert "${#lines[@]}" -gt 2 "$* $cmd: No REGISTRIES found in suggestions"
|
assert "${#lines[@]}" -gt 2 "$* $cmd: No REGISTRIES found in suggestions"
|
||||||
|
# We can assume quay.io as we force our own CONTAINERS_REGISTRIES_CONF below.
|
||||||
|
assert "${lines[0]}" == "quay.io" "unqualified-search-registries from registries.conf listed"
|
||||||
|
|
||||||
match=true
|
match=true
|
||||||
# resume
|
# resume
|
||||||
|
@ -311,6 +311,11 @@ function _check_no_suggestions() {
|
||||||
# create secret
|
# create secret
|
||||||
run_podman secret create $random_secret_name $secret_file
|
run_podman secret create $random_secret_name $secret_file
|
||||||
|
|
||||||
|
# create our own registries.conf so we know what registry is set
|
||||||
|
local CONTAINERS_REGISTRIES_CONF="$PODMAN_TMPDIR/registries.conf"
|
||||||
|
echo 'unqualified-search-registries = ["quay.io"]' > "$CONTAINERS_REGISTRIES_CONF"
|
||||||
|
export CONTAINERS_REGISTRIES_CONF
|
||||||
|
|
||||||
# Called with no args -- start with 'podman --help'. check_shell_completion() will
|
# Called with no args -- start with 'podman --help'. check_shell_completion() will
|
||||||
# recurse for any subcommands.
|
# recurse for any subcommands.
|
||||||
check_shell_completion
|
check_shell_completion
|
||||||
|
|
|
@ -1001,6 +1001,14 @@ _EOF
|
||||||
# Remove the local image to make sure it will be pulled again
|
# Remove the local image to make sure it will be pulled again
|
||||||
run_podman image rm --ignore $from_image
|
run_podman image rm --ignore $from_image
|
||||||
|
|
||||||
|
# The error below assumes unqualified-search registries exist, however the default
|
||||||
|
# distro config may not set some and thus resulting in a different error message.
|
||||||
|
# We could try to match a third or or simply force a know static config to trigger
|
||||||
|
# the right error.
|
||||||
|
local CONTAINERS_REGISTRIES_CONF="$PODMAN_TMPDIR/registries.conf"
|
||||||
|
echo 'unqualified-search-registries = ["quay.io"]' > "$CONTAINERS_REGISTRIES_CONF"
|
||||||
|
export CONTAINERS_REGISTRIES_CONF
|
||||||
|
|
||||||
_write_test_yaml command=id image=$userimage
|
_write_test_yaml command=id image=$userimage
|
||||||
run_podman 125 play kube --build --start=false $TESTYAML
|
run_podman 125 play kube --build --start=false $TESTYAML
|
||||||
assert "$output" "=~" \
|
assert "$output" "=~" \
|
||||||
|
|
Loading…
Reference in New Issue