Create GCP images in "constellation-images" project

Signed-off-by: Malte Poll <mp@edgeless.systems>
This commit is contained in:
Malte Poll 2022-05-09 17:07:12 +02:00 committed by Malte Poll
parent 9575d01ed3
commit 748eb0f96b
4 changed files with 11 additions and 4 deletions

View File

@ -82,7 +82,7 @@ jobs:
- name: "Build and Upload" - name: "Build and Upload"
run: > run: >
make -j$(nproc) CONTAINER_ENGINE=docker NETRC=/tmp/.netrc GCP_IMAGE_NAME="${{ env.IMAGE_TIMESTAMP }}" AZURE_IMAGE_NAME="${{ env.IMAGE_TIMESTAMP }}" make -j$(nproc) CONTAINER_ENGINE=docker NETRC=/tmp/.netrc GCP_IMAGE_NAME="${{ env.IMAGE_TIMESTAMP }}" GCP_IMAGE_FAMILY="constellation-debug" AZURE_IMAGE_NAME="${{ env.IMAGE_TIMESTAMP }}"
AZURE_IMAGE_DEFINITION="constellation-coreos-debugd" AZURE_IMAGE_VERSION="${{env.IMAGE_VERSION }}" DOWNLOAD_COORDINATOR=n COORDINATOR_BINARY="${{ github.workspace }}/debugd/debugd/cmd/debugd/constellation-debugd" AZURE_IMAGE_DEFINITION="constellation-coreos-debugd" AZURE_IMAGE_VERSION="${{env.IMAGE_VERSION }}" DOWNLOAD_COORDINATOR=n COORDINATOR_BINARY="${{ github.workspace }}/debugd/debugd/cmd/debugd/constellation-debugd"
image-gcp image-azure upload-gcp upload-azure image-gcp image-azure upload-gcp upload-azure
working-directory: ${{ env.working-directory }} working-directory: ${{ env.working-directory }}

View File

@ -322,7 +322,7 @@ func (i insertInstanceTemplateInput) insertInstanceTemplateRequest() *computepb.
{ {
InitializeParams: &computepb.AttachedDiskInitializeParams{ InitializeParams: &computepb.AttachedDiskInitializeParams{
DiskSizeGb: proto.Int64(10), DiskSizeGb: proto.Int64(10),
SourceImage: proto.String("projects/" + i.Project + "/global/images/" + i.ImageId), SourceImage: proto.String(i.ImageId),
}, },
AutoDelete: proto.Bool(true), AutoDelete: proto.Bool(true),
Boot: proto.Bool(true), Boot: proto.Bool(true),

View File

@ -27,7 +27,9 @@ COSA_INIT_REPO ?= "https://github.com/edgelesssys/constellatio
COSA_INIT_BRANCH ?= "constellation" COSA_INIT_BRANCH ?= "constellation"
COSA_LOCKFILE ?= $(BASE_PATH)/cosa.lock COSA_LOCKFILE ?= $(BASE_PATH)/cosa.lock
NETRC ?= ~/.netrc NETRC ?= ~/.netrc
GCP_PROJECT ?= constellation-images
GCP_BUCKET ?= constellation-images GCP_BUCKET ?= constellation-images
GCP_IMAGE_FAMILY ?= constellation
GCP_IMAGE_NAME ?= constellation-coreos GCP_IMAGE_NAME ?= constellation-coreos
GCP_IMAGE_FILENAME ?= $(GCP_IMAGE_NAME)_gcp.tar.gz GCP_IMAGE_FILENAME ?= $(GCP_IMAGE_NAME)_gcp.tar.gz
GCP_IMAGE_PATH ?= $(IMAGES_PATH)/$(GCP_IMAGE_FILENAME) GCP_IMAGE_PATH ?= $(IMAGES_PATH)/$(GCP_IMAGE_FILENAME)
@ -107,7 +109,12 @@ upload-gcp: $(GCP_IMAGE_PATH)
-gsutil mb -l $(GCP_REGION) gs://$(GCP_BUCKET) -gsutil mb -l $(GCP_REGION) gs://$(GCP_BUCKET)
gsutil pap set enforced gs://$(GCP_BUCKET) gsutil pap set enforced gs://$(GCP_BUCKET)
gsutil cp $(GCP_IMAGE_PATH) gs://$(GCP_BUCKET) gsutil cp $(GCP_IMAGE_PATH) gs://$(GCP_BUCKET)
gcloud compute images create $(GCP_IMAGE_NAME) --source-uri=gs://$(GCP_BUCKET)/$(GCP_IMAGE_FILENAME) --guest-os-features=GVNIC,SEV_CAPABLE,VIRTIO_SCSI_MULTIQUEUE,UEFI_COMPATIBLE --labels=coordinator-sha1=$$(shasum $(COORDINATOR_OVERRIDE_PATH) | cut -d " " -f 1),coordinator-sha512=$$(sha512sum $(COORDINATOR_OVERRIDE_PATH) | cut -d " " -f 1 | cut -c-63) gcloud compute images create $(GCP_IMAGE_NAME) \
--family $(GCP_IMAGE_FAMILY)
--source-uri=gs://$(GCP_BUCKET)/$(GCP_IMAGE_FILENAME) \
--guest-os-features=GVNIC,SEV_CAPABLE,VIRTIO_SCSI_MULTIQUEUE,UEFI_COMPATIBLE \
--labels=coordinator-sha1=$$(shasum $(COORDINATOR_OVERRIDE_PATH) | cut -d " " -f 1),coordinator-sha512=$$(sha512sum $(COORDINATOR_OVERRIDE_PATH) | cut -d " " -f 1 | cut -c-63) \
--project $(GCP_PROJECT)
gsutil rm gs://$(GCP_BUCKET)/$(GCP_IMAGE_FILENAME) gsutil rm gs://$(GCP_BUCKET)/$(GCP_IMAGE_FILENAME)
image-azure: $(AZURE_IMAGE_PATH) image-azure: $(AZURE_IMAGE_PATH)

View File

@ -155,7 +155,7 @@ func Default() *Config {
Project: proto.String("constellation-331613"), Project: proto.String("constellation-331613"),
Region: proto.String("europe-west3"), Region: proto.String("europe-west3"),
Zone: proto.String("europe-west3-b"), Zone: proto.String("europe-west3-b"),
Image: proto.String("constellation-coreos-1651150807"), Image: proto.String("projects/constellation-images/global/images/constellation-coreos-1651150807"),
FirewallInput: &gcpClient.FirewallInput{ FirewallInput: &gcpClient.FirewallInput{
Ingress: cloudtypes.Firewall{ Ingress: cloudtypes.Firewall{
{ {