Today, we are excited to announce the release of Activity Scripts.
Activity Scripts allow your Platform.sh projects to:
Platform.sh is built around the concept of “activities.” Any action or event will trigger one or more “activities,” which you can then use to trigger your custom Activity Scripts.
For example, pushing code to a branch will trigger an
environment.push activity, followed by an
environment.redeploy activity. You can write an activity script that is prompted by these triggers to post a Slack notification that the environment was successfully deployed. (You can find a ready-to-use example of this activity script on our documentation site. Use it as a starting point for developing your own!)
Activity Scripts generate activities as well, which makes it extremely easy to troubleshoot when debugging your script or to extend the capabilities of your script.
Activity Scripts live within your Platform.sh project, so there is no need to host it or run it anywhere else.
Every time your script gets fired, it has in its context the
activity object. This object carries a wealth of information that you can use to make decisions.
For example, on a deployment you could inspect
activity.payload.deployment.environment_info.is_production and define behaviours that vary based on the environment type. Or you could look at
activity.payload.deployment.environment_info.http_access and send a nastygram to anyone that turned off authentication on a development environment.
Now that they’re available, what activity scripts will you build? One that sends a PagerDuty notification when a deployment fails on your master environment? Or tweets every time you deploy to production on Friday? Or even updates your CDN configuration when the domain information on your project changes?
Whatever you’re inspired to build, we hope you’ll share it with the Platform.sh community. Upload your scripts, ideas, recipes, and other utilities to the activity script section of our community site.
We can’t wait to see what you come up with!