-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
e2e: add test case for credentials helper in podman
- Loading branch information
Showing
4 changed files
with
117 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
# This job runs a podman task using a container stored in a private registry | ||
# configured with credentials helper authentication. The registry.hcl job should | ||
# be running and healthy before running this job. | ||
|
||
variable "registry_address" { | ||
type = string | ||
description = "The HTTP address of the local registry" | ||
default = "localhost" | ||
} | ||
|
||
variable "registry_port" { | ||
type = number | ||
description = "The HTTP port of the local registry" | ||
default = "7511" | ||
} | ||
|
||
job "auth_static" { | ||
type = "batch" | ||
|
||
constraint { | ||
attribute = "${attr.kernel.name}" | ||
value = "linux" | ||
} | ||
|
||
group "helper" { | ||
reschedule { | ||
attempts = 0 | ||
unlimited = false | ||
} | ||
|
||
network { | ||
mode = "host" | ||
} | ||
|
||
task "echo" { | ||
driver = "podman" | ||
|
||
config { | ||
image = "${var.registry_address}:${var.registry_port}/docker.io/library/bash_auth_helper:private" | ||
args = ["echo", "The credentials helper auth test is OK!"] | ||
|
||
auth { | ||
# usename and password come from [docker-credential-]test.sh found on | ||
# $PATH as specified by "helper=test.sh" in plugin config | ||
tls_verify = false | ||
} | ||
} | ||
|
||
resources { | ||
cpu = 100 | ||
memory = 64 | ||
} | ||
} | ||
} | ||
} | ||
|
||
# test.sh (must be in $PATH) | ||
# | ||
# #!/usr/bin/env bash | ||
# set -euo pipefail | ||
# value=$(cat /dev/stdin) | ||
# username="auth_helper_user" | ||
# password="auth_helper_pass" | ||
# case "${value}" in | ||
# docker.io/*) | ||
# echo "must use local registry" | ||
# exit 3 | ||
# ;; | ||
# *) | ||
# echo "{\"Username\": \"$username\", \"Secret\": \"$password\"}" | ||
# exit 0 | ||
# ;; | ||
# esac | ||
|
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