Artifact Registry: Qwik Start
Solution for Artifact Registry: Qwik Start. 1 lab: GSP1131. Fast copy-paste commands for Google Cloud.
GSP1131 — Artifact Registry: Qwik Start
Estimated time: 10 minutes
# 🚀 Artifact Registry: Qwik Start > ⚠️ **Disclaimer:** This is an independent, community-made walkthrough created for educational purposes, hands-on practice, and Google Cloud certification preparation. This guide is designed to help learners understand Google Cloud services and complete practical exercises. Always attempt the lab yourself first and follow Google Cloud Skills Boost / Qwiklabs Terms of Service. This walkthrough is not affiliated with or endorsed by Google, Google Cloud, or Qwik
#!/bin/bash
# ==============================================================================
# ORBIT OF OPS - COMMAND 1 OF 1: ARTIFACT REGISTRY FULL AUTOMATION (FIXED)
# ==============================================================================
GREEN='\e[1;32m'
CYAN='\e[1;36m'
YELLOW='\e[1;33m'
BLUE='\e[1;34m'
MAGENTA='\e[1;35m'
WHITE='\e[1;37m'
RED='\e[1;31m'
RESET='\e[0m'
BOLD='\e[1m'
clear
echo -e "${CYAN}${BOLD}"
cat << "EOF"
____ _ _ _ __ ___
/ __ \ | | (_) | / _| / _ \
| | | |_ __| |__ _| |_ ___ | |_ | | | |_ __ ___
| | | | '__| '_ \| | __| / _ \ | _| | | | | '_ \/ __|
| |__| | | | |_) | | |_ | (_) || | | |_| | |_) \__ \
\____/|_| |_.__/|_|\__| \___/ |_| \___/| .__/|___/
| |
|_|
EOF
echo -e "${RESET}"
echo -e "${BLUE}${BOLD}╔════════════════════════════════════════════════════════════╗${RESET}"
echo -e "${BLUE}${BOLD}║ 🚀 COMMAND 1 OF 1: ARTIFACT REGISTRY (API FIXED) ║${RESET}"
echo -e "${BLUE}${BOLD}║ 🌐 BROUGHT TO YOU BY ORBIT OF OPS ║${RESET}"
echo -e "${BLUE}${BOLD}╚════════════════════════════════════════════════════════════╝${RESET}\n"
echo -e "${YELLOW}${BOLD}[Orbit of Ops] Auto-fetching Project, Zone, and Region...${RESET}"
export PROJECT_ID=$(gcloud config get-value project 2>/dev/null)
export ZONE=$(gcloud compute project-info describe \
--format="value(commonInstanceMetadata.items[google-compute-default-zone])" 2>/dev/null | tail -n 1)
if [[ -z "$ZONE" ]]; then
read -p "Please enter the lab Zone (e.g., us-east1-c): " ZONE
export ZONE
fi
export REGION=${ZONE%-*}
echo -e "✅ Project ID: ${GREEN}$PROJECT_ID${RESET}"
echo -e "✅ Region: ${GREEN}$REGION${RESET}\n"
echo -e "${BLUE}${BOLD}[Orbit of Ops] Enabling Artifact Registry API (Fixing Permission Error)...${RESET}"
gcloud services enable artifactregistry.googleapis.com
sleep 15
echo -e "\n${BLUE}${BOLD}[Orbit of Ops] Task 1: Creating Docker Repository...${RESET}"
CREATE_REPO_CMD="gcloud artifacts repositories create example-docker-repo --repository-format=docker --location=$REGION --description=\"Docker repository\" --project=$PROJECT_ID --quiet"
eval $CREATE_REPO_CMD || { echo -e "${YELLOW}API sync delay detected. Waiting 30s and retrying...${RESET}"; sleep 30; eval $CREATE_REPO_CMD; }
echo -e "\n${BLUE}${BOLD}[Orbit of Ops] Task 2: Configuring Docker Authentication...${RESET}"
gcloud auth configure-docker $REGION-docker.pkg.dev --quiet
echo -e "\n${BLUE}${BOLD}[Orbit of Ops] Task 3: Pulling Sample Docker Image...${RESET}"
docker pull us-docker.pkg.dev/google-samples/containers/gke/hello-app:1.0
echo -e "\n${BLUE}${BOLD}[Orbit of Ops] Task 4A: Tagging Docker Image for Artifact Registry...${RESET}"
docker tag us-docker.pkg.dev/google-samples/containers/gke/hello-app:1.0 \
$REGION-docker.pkg.dev/$PROJECT_ID/example-docker-repo/sample-image:tag1
echo -e "\n${BLUE}${BOLD}[Orbit of Ops] Task 4B: Pushing Docker Image to Artifact Registry...${RESET}"
docker push $REGION-docker.pkg.dev/$PROJECT_ID/example-docker-repo/sample-image:tag1
echo -e "\n${MAGENTA}${BOLD}╔════════════════════════════════════════════════════════════╗${RESET}"
echo -e "${MAGENTA}${BOLD}║ 🎉 AUTOMATION COMPLETED SUCCESSFULLY 🎉 ║${RESET}"
echo -e "${MAGENTA}${BOLD}╚════════════════════════════════════════════════════════════╝${RESET}"
echo -e "${WHITE}${BOLD}You can now check all your progress in the lab manual!${RESET}"