Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/cmd, playbooks: Drop image prefix for fedora-toolbox #615

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion images/fedora/f32/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV NAME=fedora-toolbox VERSION=32
LABEL com.github.containers.toolbox="true" \
com.github.debarshiray.toolbox="true" \
com.redhat.component="$NAME" \
name="$FGC/$NAME" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Fedora toolbox containers" \
Expand Down
2 changes: 1 addition & 1 deletion images/fedora/f33/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV NAME=fedora-toolbox VERSION=33
LABEL com.github.containers.toolbox="true" \
com.github.debarshiray.toolbox="true" \
com.redhat.component="$NAME" \
name="$FGC/$NAME" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Fedora toolbox containers" \
Expand Down
2 changes: 1 addition & 1 deletion images/fedora/f34/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV NAME=fedora-toolbox VERSION=34
LABEL com.github.containers.toolbox="true" \
com.github.debarshiray.toolbox="true" \
com.redhat.component="$NAME" \
name="$FGC/$NAME" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbox command" \
summary="Base image for creating Fedora toolbox containers" \
Expand Down
4 changes: 2 additions & 2 deletions playbooks/fedora-32/setup-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
- name: Show podman debug information
command: podman info --debug

- name: Pull registry.fedoraproject.org/f32/fedora-toolbox:32
command: podman pull registry.fedoraproject.org/f32/fedora-toolbox:32
- name: Pull registry.fedoraproject.org/fedora-toolbox:32
command: podman pull registry.fedoraproject.org/fedora-toolbox:32
register: _podman
until: _podman.rc == 0
retries: 5
Expand Down
4 changes: 2 additions & 2 deletions playbooks/fedora-33/setup-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
- name: Show podman debug information
command: podman info --debug

- name: Pull registry.fedoraproject.org/f33/fedora-toolbox:33
command: podman pull registry.fedoraproject.org/f33/fedora-toolbox:33
- name: Pull registry.fedoraproject.org/fedora-toolbox:33
command: podman pull registry.fedoraproject.org/fedora-toolbox:33
register: _podman
until: _podman.rc == 0
retries: 5
Expand Down
4 changes: 2 additions & 2 deletions playbooks/fedora-34/setup-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
- name: Show podman debug information
command: podman info --debug

- name: Pull registry.fedoraproject.org/f34/fedora-toolbox:34
command: podman pull registry.fedoraproject.org/f34/fedora-toolbox:34
- name: Pull registry.fedoraproject.org/fedora-toolbox:34
command: podman pull registry.fedoraproject.org/fedora-toolbox:34
register: _podman
until: _podman.rc == 0
retries: 5
Expand Down
4 changes: 2 additions & 2 deletions playbooks/fedora-rawhide/setup-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
- name: Show podman debug information
command: podman info --debug

- name: Pull registry.fedoraproject.org/f34/fedora-toolbox:34
command: podman pull registry.fedoraproject.org/f34/fedora-toolbox:34
- name: Pull registry.fedoraproject.org/fedora-toolbox:34
command: podman pull registry.fedoraproject.org/fedora-toolbox:34
register: _podman
until: _podman.rc == 0
retries: 5
Expand Down
12 changes: 9 additions & 3 deletions src/pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ var (
"fedora-toolbox",
parseReleaseFedora,
"registry.fedoraproject.org",
"f%s",
true,
"",
false,
},
"rhel": {
"rhel-toolbox",
Expand Down Expand Up @@ -345,7 +345,13 @@ func GetFullyQualifiedImageFromDistros(image, release string) (string, error) {
repository = distroObj.Repository
}

imageFull := distroObj.Registry + "/" + repository + "/" + image
imageFull := distroObj.Registry

if repository != "" {
imageFull = imageFull + "/" + repository
}

imageFull = imageFull + "/" + image

logrus.Debugf("Resolved image %s to %s", image, imageFull)

Expand Down
2 changes: 1 addition & 1 deletion test/system/101-create.bats
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ teardown() {
}

@test "create: Create a container with a custom image and name ('fedora29'; f29)" {
pull_image 29
pull_image_old 29

run toolbox -y create -c "fedora29" -i fedora-toolbox:29

Expand Down
2 changes: 1 addition & 1 deletion test/system/102-list.bats
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ teardown() {
@test "list: Try to list images and containers (no flag) with 3 containers and 2 images (the list should have 3 images and 2 containers)" {
# Pull the two images
pull_default_image
pull_image 29
pull_image_old 29
# Create tree containers
create_default_container
create_container non-default-one
Expand Down
27 changes: 26 additions & 1 deletion test/system/libs/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,31 @@ function get_busybox_image() {


function pull_image() {
local version
local image
local -i count
local -i max_retries
local -i wait_time
version="$1"
image="${REGISTRY_URL}/fedora-toolbox:${version}"
count=0
max_retries=5
wait_time=15

until ${PODMAN} pull "${image}" >/dev/null ; do
sleep $wait_time
(( count += 1 ))

if (( "$count" == "$max_retries" )); then
# Max number of retries exceeded
echo "Podman couldn't pull the image ${image}."
return 1
fi
done
}


function pull_image_old() {
local version
local image
local -i count
Expand Down Expand Up @@ -63,7 +88,7 @@ function create_container() {
local image
container_name="$1"
version="$DEFAULT_FEDORA_VERSION"
image="${REGISTRY_URL}/f${version}/fedora-toolbox:${version}"
image="${REGISTRY_URL}/fedora-toolbox:${version}"

pull_image "$version"

Expand Down