Skip to content

Commit

Permalink
SQDEVOPS-455 Publish staging images to the GCP registry
Browse files Browse the repository at this point in the history
  • Loading branch information
carminevassallo authored Mar 5, 2024
1 parent cba418a commit 90348e2
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion .cirrus/tasks.yml
Original file line number Diff line number Diff line change
@@ -13,6 +13,8 @@ env:
PUBLIC_IMAGE_NAME: sonarqube
GCLOUD_REGISTRY: gcr.io/sonarsource-public
GCLOUD_PRODUCT_NAME: official-sonarqube-data-center-edition
GCLOUD_STAGING_REGISTRY: gcr.io/sonarqube-marketplace-provider
GCLOUD_STAGING_PRODUCT_NAME: sonarqube-dce-staging
CURRENT_LTS_VERSION: 9.9.4
CURRENT_VERSION: 10.4.1
NEXT_VERSION: 10.5.0
@@ -24,7 +26,7 @@ vm_instance_template: &VM_TEMPLATE
region: eu-central-1
subnet_id: ${CIRRUS_AWS_SUBNET}

multi_arch_build_gcp_task:
multi_arch_build_gcp_prod_task:
only_if: $CIRRUS_CRON == 'nightly-mend-scan' || $TRIGGER == 'PUSH_GCP_IMAGES'
ec2_instance:
<<: *VM_TEMPLATE
@@ -47,6 +49,30 @@ multi_arch_build_gcp_task:
- docker tag "${PUBLIC_IMAGE_NAME}:${CURRENT_VERSION}-datacenter-search" "${GCLOUD_REGISTRY}/${GCLOUD_PRODUCT_NAME}/sonarqube-dce-search:${CURRENT_MINOR_VERSION}"
- docker push "${GCLOUD_REGISTRY}/${GCLOUD_PRODUCT_NAME}/sonarqube-dce-search:${CURRENT_VERSION}"
- docker push "${GCLOUD_REGISTRY}/${GCLOUD_PRODUCT_NAME}/sonarqube-dce-search:${CURRENT_MINOR_VERSION}"

multi_arch_build_gcp_staging_task:
only_if: $CIRRUS_CRON == 'nightly-mend-scan' || $TRIGGER == 'PUSH_GCP_STAGING_IMAGES'
env:
matrix:
- version: 10/datacenter/app
STAGING_IMAGE_NAME: ${GCLOUD_STAGING_REGISTRY}/${GCLOUD_STAGING_PRODUCT_NAME}
- version: 10/datacenter/search
STAGING_IMAGE_NAME: ${GCLOUD_STAGING_REGISTRY}/${GCLOUD_STAGING_PRODUCT_NAME}/sonarqube-dce-search
ec2_instance:
<<: *VM_TEMPLATE
login_to_gcr_script:
- export DOCKER_GCLOUD_PASSWORD=$(echo ${DOCKER_GCLOUD_SA_KEY} | base64 -d)
- docker login -u _json_key -p "$DOCKER_GCLOUD_PASSWORD" https://${GCLOUD_STAGING_REGISTRY}
setup_multi_build_script:
- docker run -t --rm --privileged tonistiigi/binfmt --install all
- docker buildx create --name multibuilder --driver docker-container
- docker buildx use multibuilder
- docker buildx inspect --bootstrap
build_script:
- export NEXT_MINOR_VERSION=$(echo ${NEXT_VERSION} | cut -d '.' -f 1,2)
- echo "Build and promote the ${STAGING_IMAGE_NAME}:${NEXT_VERSION} and ${STAGING_IMAGE_NAME}:${NEXT_MINOR_VERSION} image supporting two architectures, linux/amd64 and linux/arm64"
- .cirrus/multi-arch-build.sh ${STAGING_IMAGE_NAME} $NEXT_VERSION ${version}
- .cirrus/multi-arch-build.sh ${STAGING_IMAGE_NAME} $NEXT_MINOR_VERSION ${version}

multi_arch_build_task:
env:

0 comments on commit 90348e2

Please sign in to comment.