Cloud build build order for CCD

Is there any way to modify the build execution order for Cloud Build so that the Post-Build Script is executed after the Content Cloud Delivery processing?

I would like to add a custom badge to the latest CCD but the CCD looks to be run after the Post Build.

Any advice would be appreciated.

1 Like

Hi!

There’s not currently a way to customize the execution order of the build steps. We are looking into having a more flexible configuration in the future, but this is currently not possible. However, there are two ways you could add a custom badge to the latest CCD:

  • Write your own script to upload to CCD and create the badge.
  • Create a web hook when your build is completed and implement the badge creation in this hook.

Hope this helps!

Hi @Barb-Unity thank you getting back to me.

We currently have a shell scrip running in the post build. Currently the Auth is failing as I believe the CLI version for CCD is out of date so the flag –apikey is not working. Is it possible to update the version of the CLI or do we need to supply the CLI binary with our script instead of using the installed binary on Cloud Build?

Currently this is outputted from our script:

| - VERSION
| - ucd version 0.10.9
| - SYNC ASSETS
| - An update of the Cloud Content Delivery CLI is available. Please visit https://dashboard.unity3d.com to get the latest version.
| - No saved credentials found. Run ‘auth login’ to login to your account.
| - CREATE RELEASE
| - unknown flag: --apkkey

Thanks for your help. I look forward to things to come with the CB configuration.

@Barb-Unity I have just realised that I spelt apikey wrong ‍♂️
I am just running a new build so fingers crossed getting the right flag works.

Hi @Barb-Unity ,

I have now been able to successfully upload and create a release with a custom badge to CCD using our Cloud Build Post build script so Happy Friday!

For anyone else looking at having more control over their CCD upload here is the CLI calls in our build script:

# Get the directory of the script
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

# Pull the build target from the build json
BUILD_TARGET=$(jq -r 'keys[0]' < build.json)

#API key from the CCD bucket setup
CCD_API_KEY="ABCD"

# The bucket ID
CCD_BUCKET="ABCD"

# The environment ID for Production or Development
CCD_ENVIRONMENT="$3"

# The custom badge we would like to use, we used UCB_BUILD_NUMBER which is an env var set by Cloud Build
CCD_BADGE="${UCB_BUILD_NUMBER}"

# Path to the CCD CLI that is uploaded with the script to make sure we are using the latest version
CCD_BINARY_PATH="${__dir}/ccd/0.11.15_osx_ucd"

# The path to the Addressable content (WORKSPACE an env var)
CCD_ASSET_PATH="${WORKSPACE}/.build/last/${BUILD_TARGET}/extra_data/addrs"

# Upload the Addressable assets to the bucket
$CCD_BINARY entries sync $CCD_ASSET_PATH --bucket $CCD_BUCKET --apikey=$CCD_API_KEY --environment=$CCD_ENVIRONMENT

# Create a release on the bucket and add the custom badge
$CCD_BINARY releases create --bucket=$CCD_BUCKET --badge=$CCD_BADGE --apikey=$CCD_API_KEY --environment=$CCD_ENVIRONMENT -n "Release for $CCD_BADGE"

# Celebrate!

ahh so you are uploading the addressables manually in the post-build script and then doing the releases creation after it. Nice solution. We’ll try get a way to support this “natively” on the platform, same with --environment config

1 Like

Thanks, i’m just glad it’s working.

Glad to hear that it’s working now! Happy developing!

Any updates here now that Unity DevOps has launched and build pricing has significantly changed? I’m looking for significant improvements in control of the build processes and functionality now that we’re paying on a consumption based model.

The CCD CLI versions have been updated and support for CCD environments are now available in the UI.

The ability to customize the order of build steps is on our backlog but we do not have an estimated date that we will be releasing this capability.

In lieu of being able to customize the order of the build steps, could we get a place in the cloud build configuration addressable section to plug in a badge number? Or better yet, another post-CCD script?
I arrived at this thread the same way it appears everyone else did. By discovering the post-build script triggers too soon and the badge I’m creating in my script is getting associated with the prior release as the current one hasn’t been created yet.

At this point in time we have no plans to change how this functions directly in the Cloud Build Automation system.

We are working on further expanding support for steps that execute after build automation is complete, including our implementation of CCD. This could include things like Python scripts, uploads to App stores, bash scripts, etc. We are in discussions with the UGS team and other teams inside Unity in regards to supporting this functionality so that there is more robust functionality within cloud build pipelines.

This is in active development with the hopes of launching our beta in the second half of this year.

2 Likes