#318 publish cloud image into GCP for f33
Closed: fixed 4 years ago by dustymabe. Opened 4 years ago by dustymabe.

Now that we are creating a GCP artifact it would be nice if we would create an image so users don't have to create their own. This ticket tracks that work.


I ran the following commands to create a license for Fedora 33 cloud
base (using the attached license.sh:

./license.sh create fedora-cloud "fedora-33-cloud-base" "Fedora 33 Cloud Base"
Creating license ID for fedora-33-cloud-base with description Fedora 33 Cloud Base
{
  "id": "5694348925458930421",
  "name": "operation-1605821466175-5b47c72106725-6d114ca6-b3fc9aed",
  "operationType": "compute.licenses.insert",
  "targetLink": "https://www.googleapis.com/compute/v1/projects/fedora-cloud/global/licenses/fedora-33-cloud-base",
  "targetId": "646646099248634613",
  "status": "DONE",
  "user": "dustymabe-service-account@fedora-cloud.iam.gserviceaccount.com",
  "progress": 100,
  "insertTime": "2020-11-19T13:31:06.849-08:00",
  "startTime": "2020-11-19T13:31:06.852-08:00",
  "endTime": "2020-11-19T13:31:06.852-08:00",
  "selfLink": "https://www.googleapis.com/compute/v1/projects/fedora-cloud/global/operations/operation-1605821466175-5b47c72106725-6d114ca6-b3fc9aed",
  "kind": "compute#operation"
}

I created a storage bucket to use for image uploads like so:

gsutil mb -b off -p fedora-cloud gs://fedora-cloud-image-uploads
gsutil iam ch allUsers:objectViewer gs://fedora-cloud-image-uploads

# Delete objects after 60 days
cat<<EOF >lifecycle.json
    {
      "rule":
      [
        {
          "action": {"type": "Delete"},
          "condition": {"age": 60}
        }
      ]
    }
EOF
gsutil lifecycle set ./lifecycle.json gs://fedora-cloud-image-uploads

I then created the image in GCP with the following commands:

FILE=Fedora-Cloud-Base-GCP-33-1.2.x86_64.tar.gz
IMAGE=${FILE,,}        # convert to lower case
IMAGE=${IMAGE:0:-7}     # pull off .tar.gz
IMAGE=${IMAGE//[._]/-} # replace . and _ with -
gsutil cp $FILE gs://fedora-cloud-image-uploads
gcloud compute images create $IMAGE \
        --project fedora-cloud      \
        --family fedora-cloud-33    \
        --source-uri gs://fedora-cloud-image-uploads/$FILE         \
        --guest-os-features=UEFI_COMPATIBLE,VIRTIO_SCSI_MULTIQUEUE \
        --description="Fedora, Fedora Cloud Base 33, 33-20201019.0, x86_64 published on 2020-09-29" \
        --licenses=https://compute.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx,https://www.googleapis.com/compute/v1/projects/fedora-cloud/global/licenses/fedora-33-cloud-base

I can now see and launch the image from other accounts:

# gcloud compute images list --project fedora-cloud --no-standard-images
NAME                                 PROJECT       FAMILY           DEPRECATED  STATUS
fedora-cloud-base-gcp-33-1-2-x86-64  fedora-cloud  fedora-cloud-33              READY

Metadata Update from @dustymabe:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

4 years ago

Log in to comment on this ticket.

Metadata
Attachments 1
Attached 4 years ago View Comment