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

psmdb-image-preparation #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
59 changes: 59 additions & 0 deletions redhat-certification/psmdb/images-preparation.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
repo='percona'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change the extension to .sh and put the shebang #!/usr/bin/env bash?

psmdb-operator="percona-server-mongodb-operator"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to psmdb_operator here and in line 27

psmdb="percona-server-mongodb"
pbm="percona-backup-mongodb"
release='1.16.0'
pmm_version='2.41.2'
psmdb7_version="7.0.8-5"
psmdb6_version="6.0.15-12"
psmdb5_version="5.0.26-22"
psmdb_backup_version="2.4.1"

export PSMDB_IMAGES_PROJECT_ID="5e627846b6bf136294e8bb8b"
export PSMDB_OPERATOR_PROJECT_ID="5e62470102235d3f505f60e3"
export PSMDB_IMAGES_PROJECT_USER="redhat-isv-containers+5e627846b6bf136294e8bb8b-robot"
export PSMDB_OPERATOR_PROJECT_USER="redhat-isv-containers+5e62470102235d3f505f60e3-robot"
Comment on lines +12 to +15

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these private?
Also ,we can simplify to PSMDB_IMAGES_PROJECT_USER="redhat-isv-containers+$PSMDB_IMAGES_PROJECT_ID-robot" and the same for the operator


export REDHAT_CONTAINERS_KEY=""
export REDHAT_OPERATOR_KEY=""
export PYXIS_API_TOKEN=""

if [[ -z $PYXIS_API_TOKEN || -z $REDHAT_CONTAINERS_KEY || -z $REDHAT_OPERATOR_KEY ]]; then
echo "PYXIS_API_TOKEN or REDHAT_OPERATOR_KEY or REDHAT_CONTAINERS_KEY are empty, please add it"
fi

# OPERATOR IMAGE
echo "$REDHAT_OPERATOR_KEY" | docker login -u $PSMDB_OPERATOR_PROJECT_USER quay.io --password-stdin
docker pull --platform linux/amd64 $repo/${psmdb-operator}:${release}
operator_image_id=`docker images | grep "${release} " | awk '{print $3}'`
echo $operator_image_id
docker tag $operator_image_id quay.io/redhat-isv-containers/${PSMDB_OPERATOR_PROJECT_ID}:${release} && docker push quay.io/redhat-isv-containers/${PSMDB_OPERATOR_PROJECT_ID}:${release}
preflight check container --platform=linux/amd64 quay.io/redhat-isv-containers/${PSMDB_OPERATOR_PROJECT_ID}:${release} --docker-config=/Users/marukovich/.docker/config.json --submit --pyxis-api-token=$PYXIS_API_TOKEN --certification-project-id=$PSMDB_OPERATOR_PROJECT_ID

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should create an env var for the docker config file. Please check the same in the cmds below


# PSMDB IMAGES
echo "$REDHAT_CONTAINERS_KEY" | docker login -u $PSMDB_IMAGES_PROJECT_USER quay.io --password-stdin

for postfix in psmdb7_version psmdb6_version psmdb5_version
do
docker pull --platform linux/amd64 $repo/$psmdb:$postfix
image_id=`docker images | grep "$postfix " | awk '{print $3}'`
echo $image_id
docker tag $image_id quay.io/redhat-isv-containers/${PSMDB_IMAGES_PROJECT_ID}:${postfix} && docker push quay.io/redhat-isv-containers/${PSMDB_IMAGES_PROJECT_ID}:${postfix}
preflight check container --platform=linux/amd64 quay.io/redhat-isv-containers/${PSMDB_IMAGES_PROJECT_ID}:${postfix} --docker-config=/Users/marukovich/.docker/config.json --submit --pyxis-api-token=$PYXIS_API_TOKEN --certification-project-id=$PSMDB_IMAGES_PROJECT_ID
done


# PSMDB BACKUP

docker pull --platform linux/amd64 percona/${pbm}:${psmdb_backup_version}
image_id=`docker images | grep "${psmdb_backup_version} " | awk '{print $3}'`
echo $image_id
docker tag $image_id quay.io/redhat-isv-containers/${PSMDB_IMAGES_PROJECT_ID}:${release}-backup && docker push quay.io/redhat-isv-containers/${PSMDB_IMAGES_PROJECT_ID}:${release}-backup
preflight check container --platform=linux/amd64 quay.io/redhat-isv-containers/${PSMDB_IMAGES_PROJECT_ID}:${release}-backup --docker-config=/Users/marukovich/.docker/config.json --submit --pyxis-api-token=$PYXIS_API_TOKEN --certification-project-id=$PSMDB_IMAGES_PROJECT_ID

# PMM
docker pull $repo/pmm-client:$pmm_version
pmm_image_id=`docker images | grep "pmm-client" | grep "$pmm_version" | awk '{print $3}'`
docker tag $pmm_image_id quay.io/redhat-isv-containers/${PSMDB_IMAGES_PROJECT_ID}:${release}-pmm && docker push quay.io/redhat-isv-containers/${PSMDB_IMAGES_PROJECT_ID}:${release}-pmm
preflight check container --platform=linux/amd64 quay.io/redhat-isv-containers/${PSMDB_IMAGES_PROJECT_ID}:${release}-pmm --docker-config=/Users/marukovich/.docker/config.json --submit --pyxis-api-token=$PYXIS_API_TOKEN --certification-project-id=$PSMDB_IMAGES_PROJECT_ID