Desired flow promoting custom types and slice definitions through multiple environments

We are looking into how to incorporate the slice machine sync in our CI/CD pipeline (on Azure DevOps), combined with Prismic's feature of having multiple environments. So far we found out that there is no slice-machine cli and that the prismic cli does not have a feature to sync (upload) custom types and slices.

The desired development flow

Given we have the following Prismic setup:

  • Production repository, with 2 additional environments
  • Acceptance (staging) environment
  • Testing (staging) environment
  • All custom types and slice definitions live in a single GIT repository

We have a top-down content flow:

  • The content flows from Production to Acceptance to Testing.
  • This is done via de Prismic dashboard, manually

We would like to have a bottom-up flow for custom types and slice definitions:

  • The definitions flows from Testing to Acceptance to Production
  • The DTAP-flow is a common software development flow, often mandated by organisations
  • Promotion of the content and slice definitions is done via a CI/CD pipeline using a cli command or script

The issue

We are investigating how to do the promotion of custom types and slice definitions via CI/CD as manually syncing from local to production via Slice Machine is undesired (risk). The recommended way seems to use the customtypes-api, for custom types. We then have to create a script/program to use that API. Same API seems to be usable for syncing slices, which slice machine seem to as well.

It seems we are not the only one looking into this:

Am I missing something? Are we expected to develop our own tool for syncing custom type and slice definitions to the desired environment? How does Prismic expect to use the environments in a professional CI/CD development flow?

1 Like

Hi @tim.van.den.hof,

This is a topic/question we’ve been hearing a lot about since Slice Machine debuted.

The custom types API is the way to go for now. You will need to build your own script to set up automation with it. There is a custom types API client that should make this easier:

Let us know if you have any other questions.

Well we have been making some progress. We currently have a simple form of synchronisation tool that inserts/updates/deletes custom types and shared slices. Which seem to work fine, except the screenshots part.

The slices have a model.json where the imageUrl is different than the imageUrl that is actually on the Prismic servers. That got us thinking and digging into the Slice Machine sources. Found out that Slice Machine has a ScreenshotManager to handle the uploads. These seem to go to an AWS api requiring authorization, which seems to be a user token. So far the synchronisation tool is using just a token for the Custom Types API and not doing anything with the screenshots, nor a user token (just a permanent api token). Currently exploring solutions for the screenshot part, that also keep Slice Machine in a happy synchronised state.

Hi @tim.van.den.hof

I am the Product manager of the DevTools team at Prismic.
What you are discussing is something we would like to study in the coming months. Would you be ok if @mabel.tan, our UX researcher gets in touch with you to organize a discussion on the topic?

All the best,

Côme

1 Like

Hi Côme,

That is fine, feel free to contact me.
More than happy to explain how our development flow looks like in our enterprise environment.

Kind Regards,
Tim

1 Like

Hey @come.sabran do you have an update on this? or a stop gap solution. Would really like to automate the slices and types deployment via our CI/CD pipeline

Hi there,

A quick update on this topic, thanks for your insights. The team has ran a Beta round to test a few concepts and solutions inorder to solve these problems. We came up with super valuable insights that let us design a solution that we believe will be the best workflow for teams to:

  • collaborate between developers without confilicts
  • Update code/models/content without risk and content freeze

We have decided to start delivering on this project by the end of the year, but now the Prismic Devtools squad is focused on its current challenge around improving the modelling capabilities.

Thank you for your understanding.

Côme