#7851 Use manifest list for stg container base image
Merged 5 years ago by mohanboddu. Opened 5 years ago by cverna.
cverna/releng stg_container-release  into  master

@@ -53,129 +53,99 @@ 

      printf "INFO: PERFORMING STAGE SYNC\n"

      stage="true"

  fi

- # If ${stage} is a non-zero length string, then perform staging

- if [[ -z "$stage" ]]; then

-     # Obtain the latest build

-     #

-     #   Need fXX-updates-canddiate to get actual latest nightly

-     #

-     if [[ "${1}" > 27 ]];

-     then

-         build_name=$(koji -q latest-build --type=image f${1}-updates-candidate Fedora-Container-Base | awk '{print $1}')

-     else

-         build_name=$(koji -q latest-build --type=image f${1}-updates-candidate Fedora-Docker-Base | awk '{print $1}')

-     fi

- 

-     if [[ ${1} -eq "$current_stable" ]]; then

-         tagname="latest"

-     fi

-     if [[ ${1} -eq "$current_rawhide" ]]; then

-         tagname="rawhide"

-     fi

+ # Obtain the latest build

+ #

+ #   Need fXX-updates-canddiate to get actual latest nightly

+ #

+ if [[ "${1}" > 27 ]];

+ then

+     build_name=$(koji -q latest-build --type=image f${1}-updates-candidate Fedora-Container-Base | awk '{print $1}')

+ else

+     build_name=$(koji -q latest-build --type=image f${1}-updates-candidate Fedora-Docker-Base | awk '{print $1}')

+ fi

  

-     minimal_build_name=$(koji -q latest-build --type=image f${1}-updates-candidate Fedora-Container-Minimal-Base | awk '{print $1}')

-     if [[ -n ${build_name} ]]; then

-         # Download the image

-         work_dir=$(mktemp -d)

-         pushd ${work_dir} &> /dev/null

-             koji download-build --type=image  ${build_name}

-             # Import the image

-             for arch in "${ARCHES[@]}"

-             do

-                 xz -d ${build_name}.${arch}.tar.xz

-                 skopeo copy docker-archive:${build_name}.${arch}.tar docker://registry.fedoraproject.org/fedora:${1}-${arch}

-                 skopeo copy docker-archive:${build_name}.${arch}.tar docker://candidate-registry.fedoraproject.org/fedora:${1}-${arch}

-             done

+ if [[ ${1} -eq "$current_stable" ]]; then

+     tagname="latest"

+ fi

+ if [[ ${1} -eq "$current_rawhide" ]]; then

+     tagname="rawhide"

+ fi

  

-         popd &> /dev/null

+ minimal_build_name=$(koji -q latest-build --type=image f${1}-updates-candidate Fedora-Container-Minimal-Base | awk '{print $1}')

+ if [[ -n ${build_name} ]]; then

+     # Download the image

+     work_dir=$(mktemp -d)

+     pushd ${work_dir} &> /dev/null

+     koji download-build --type=image  ${build_name}

+     # Import the image

+     for arch in "${ARCHES[@]}"

+     do

+         xz -d ${build_name}.${arch}.tar.xz

+         # If ${stage} is a non-zero length string, then perform staging

+         if [[ -z "$stage" ]]; then

+             registries=("registry.fedoraproject.org" "candidate-registry.fedoraproject.org")

+             skopeo copy docker-archive:${build_name}.${arch}.tar docker://registry.fedoraproject.org/fedora:${1}-${arch}

+             skopeo copy docker-archive:${build_name}.${arch}.tar docker://candidate-registry.fedoraproject.org/fedora:${1}-${arch}

+         else

+             registries=("registry.stg.fedoraproject.org" "candidate-registry.stg.fedoraproject.org")

+             skopeo copy docker-archive:${build_name}.${arch}.tar docker://registry.stg.fedoraproject.org/fedora:${1}-${arch}

+             skopeo copy docker-archive:${build_name}.${arch}.tar docker://candidate-registry.stg.fedoraproject.org/fedora:${1}-${arch}

+         fi

+     done

  

-         for registry in "registry.fedoraproject.org" "candidate-registry.fedoraproject.org"

-         do

-             printf "Push manifest to ${registry}\n"

-             if [ -z "$tagname" ]

-             then

-                 printf "tag is not set: ${tagname}\n"

-                 python3 generate-manifest-list.py -r ${1} --registry ${registry} --image fedora

-             else

-                 printf "tag is set: ${tagname}\n"

-                 python3 generate-manifest-list.py -r ${1} --registry ${registry} --tag ${tagname} --image fedora

-             fi

-         done

-         printf "Removing temporary directory\n"

-         rm -rf $work_dir

-     fi

-     if [[ -n ${minimal_build_name} ]]; then

-         # Download the image

-         work_dir=$(mktemp -d)

-         pushd ${work_dir} &> /dev/null

-             koji download-build --type=image  ${minimal_build_name}

-             # Import the image

-             for arch in "${ARCHES[@]}"

-             do

-                 xz -d ${minimal_build_name}.${arch}.tar.xz

-                 skopeo copy docker-archive:${minimal_build_name}.${arch}.tar docker://registry.fedoraproject.org/fedora-minimal:${1}-${arch}

-                 skopeo copy docker-archive:${minimal_build_name}.${arch}.tar docker://candidate-registry.fedoraproject.org/fedora-minimal:${1}-${arch}

+     popd &> /dev/null

  

-             done

-         popd &> /dev/null

+     for registry in "${registries[@]}"

+     do

+         printf "Push manifest to ${registry}\n"

+         if [ -z "$tagname" ]

+         then

+             printf "tag is not set: ${tagname}\n"

+             python3 generate-manifest-list.py -r ${1} --registry ${registry} --image fedora

+         else

+             printf "tag is set: ${tagname}\n"

+             python3 generate-manifest-list.py -r ${1} --registry ${registry} --tag ${tagname} --image fedora

+         fi

+     done

+     printf "Removing temporary directory\n"

+     rm -rf $work_dir

+ fi

+ if [[ -n ${minimal_build_name} ]]; then

+     # Download the image

+     work_dir=$(mktemp -d)

+     pushd ${work_dir} &> /dev/null

+     koji download-build --type=image  ${minimal_build_name}

+     # Import the image

+     for arch in "${ARCHES[@]}"

+     do

+         xz -d ${minimal_build_name}.${arch}.tar.xz

+         # If ${stage} is a non-zero length string, then perform staging

+         if [[ -z "$stage" ]]; then

+             registries=("registry.fedoraproject.org" "candidate-registry.fedoraproject.org")

+             skopeo copy docker-archive:${minimal_build_name}.${arch}.tar docker://registry.fedoraproject.org/fedora-minimal:${1}-${arch}

+             skopeo copy docker-archive:${minimal_build_name}.${arch}.tar docker://candidate-registry.fedoraproject.org/fedora-minimal:${1}-${arch}

+         else

+             registries=("registry.stg.fedoraproject.org" "candidate-registry.stg.fedoraproject.org")

+             skopeo copy docker-archive:${minimal_build_name}.${arch}.tar docker://registry.stg.fedoraproject.org/fedora-minimal:${1}-${arch}

+             skopeo copy docker-archive:${minimal_build_name}.${arch}.tar docker://candidate-registry.stg.fedoraproject.org/fedora-minimal:${1}-${arch}

+         fi

+      done

+      popd &> /dev/null

  

-         for registry in "registry.fedoraproject.org" "candidate-registry.fedoraproject.org"

-         do

-             printf "Push manifest to ${registry}\n"

-             if [ -z "$tagname" ]

-             then

-                 printf "tag is not set: ${tagname}\n"

-                 python3 generate-manifest-list.py -r ${1} --registry ${registry} --image fedora-minimal

-             else

-                 printf "tag is set: ${tagname}\n"

-                 python3 generate-manifest-list.py -r ${1} --registry ${registry} --tag ${tagname} --image fedora-minimal

-             fi

-         done

+      for registry in "${registries[@]}"

+      do

+          printf "Push manifest to ${registry}\n"

+          if [ -z "$tagname" ]

+          then

+              printf "tag is not set: ${tagname}\n"

+              python3 generate-manifest-list.py -r ${1} --registry ${registry} --image fedora-minimal

+          else

+              printf "tag is set: ${tagname}\n"

+              python3 generate-manifest-list.py -r ${1} --registry ${registry} --tag ${tagname} --image fedora-minimal

+          fi

+      done

  

-         printf "Removing temporary directory\n"

-         rm -rf $work_dir

+      printf "Removing temporary directory\n"

+      rm -rf $work_dir

  

-     fi

- else

-     # For stage, we only mirror what's in production.

-     printf "Skopeo syncing registry.stg.fedoraproject.org/fedora:${1} ...\n"

-     sudo skopeo copy \

-         --src-cert-dir /etc/docker/certs.d/registry.stg.fedoraproject.org/ \

-         --dest-cert-dir /etc/docker/certs.d/candidate-registry.stg.fedoraproject.org/ \

-         docker://registry.fedoraproject.org/fedora:${1} \

-         docker://registry.stg.fedoraproject.org/fedora:${1}

-     printf "Skopeo syncing candidate-registry.stg.fedoraproject.org/fedora:${1} ...\n"

-     sudo skopeo copy \

-         --src-cert-dir /etc/docker/certs.d/registry.stg.fedoraproject.org/ \

-         --dest-cert-dir /etc/docker/certs.d/candidate-registry.stg.fedoraproject.org/ \

-         docker://registry.fedoraproject.org/fedora:${1} \

-         docker://candidate-registry.stg.fedoraproject.org/fedora:${1}

-     if [[ ${1} -eq "$current_stable" ]]; then

-         printf "Skopeo syncing registry.stg.fedoraproject.org/fedora:latest ...\n"

-         sudo skopeo copy \

-             --src-cert-dir /etc/docker/certs.d/registry.stg.fedoraproject.org/ \

-             --dest-cert-dir /etc/docker/certs.d/candidate-registry.stg.fedoraproject.org/ \

-             docker://registry.fedoraproject.org/fedora:${1} \

-             docker://registry.stg.fedoraproject.org/fedora:latest

-         printf "Skopeo syncing candidate-registry.stg.fedoraproject.org/fedora:latest ...\n"

-         sudo skopeo copy \

-             --src-cert-dir /etc/docker/certs.d/registry.stg.fedoraproject.org/ \

-             --dest-cert-dir /etc/docker/certs.d/candidate-registry.stg.fedoraproject.org/ \

-             docker://registry.fedoraproject.org/fedora:${1} \

-             docker://candidate-registry.stg.fedoraproject.org/fedora:latest

-     fi

-     if [[ ${1} -eq "$current_rawhide" ]]; then

-         printf "Skopeo syncing registry.stg.fedoraproject.org/fedora:rawhide ...\n"

-         sudo skopeo copy \

-             --src-cert-dir /etc/docker/certs.d/registry.stg.fedoraproject.org/ \

-             --dest-cert-dir /etc/docker/certs.d/candidate-registry.stg.fedoraproject.org/ \

-             docker://registry.fedoraproject.org/fedora:${1} \

-             docker://registry.stg.fedoraproject.org/fedora:latest

-         printf "Skopeo syncing candidate-registry.stg.fedoraproject.org/fedora:rawhide ...\n"

-         sudo skopeo copy \

-             --src-cert-dir /etc/docker/certs.d/registry.stg.fedoraproject.org/ \

-             --dest-cert-dir /etc/docker/certs.d/candidate-registry.stg.fedoraproject.org/ \

-             docker://registry.fedoraproject.org/fedora:${1} \

-             docker://candidate-registry.stg.fedoraproject.org/fedora:latest

-     fi

  fi

This keeps the stg and prod seperated so we don't have to release prod and stg together. But it brings multi arch support to stg which will be needed for OSBS.

Signed-off-by: Clement Verna cverna@tutanota.com

This keeps the stg and prod seperated

I guess this statement is wrong, we are trying to keep them together, right?

Pull-Request has been merged by mohanboddu

5 years ago

This keeps the stg and prod seperated

I guess this statement is wrong, we are trying to keep them together, right?

What I meant is that we can still use the -s in the cli to release only stg

Metadata