- Status: Proposed
- Author: Tony Braasch
- Deciders: Abyss Team
- Date: 10/4/24
Context
Both the Abyss web and mobile libraries rely on assets hosted on our abyss-cloud CDN. These assets include icons, images, and fonts. Historically, we have not versioned our CDN, leading to direct overwrites with each deployment. This lack of versioning restricts our ability to update asset structures or CDN paths without causing breaking changes for existing versions of our components.
Decision
We have decided to implement versioning for our CDN assets. This will allow us to make necessary structural changes to the assets and their referencing paths in our components without affecting the current implementations in use by consuming teams.
Reasons for Decision
- Avoid Breaking Changes: Versioning the CDN allows us to update assets and modify file structures without impacting existing users of the library.
- Facilitate Continuous Development: With versioned assets, we can continuously develop and improve our asset library.
- Best Practices: Versioning is a best practice for asset management, especially in scalable and evolving projects, ensuring reliability and clarity in dependency management.
Implementation
- Create Assets Release Pipeline: Introduced in
abyss-create-assets-release.yml, this pipeline, similar toabyss-create-release, handles version bumping forabyss-assetsbased on major/minor/patch selections and creates a corresponding release branch. - Updated Deployment Workflows:
assets-integrate.yml: Modified to pull the package version fromabyss-assetsand append it to the S3 bucket path upon changes to the release branch. Will automatically run when assets changes are pushed to an assets release branch.assets-release.yml: Requires manual trigger for deployment to ensure controlled releases. Integrated with the versioning system to append version to the S3 bucket path.
- Central Management of CDN URL: Implemented in
getCdnUrl.jsfor web to centralize the management of CDN URLs, thus easing updates and maintenance. Something similar still needs to be implemented within mobile. - Version Initialization: Starting the
abyss-assetspackage version at 1.0.0, decoupling it from the versioning of web and mobile components. - Prepublish Script Modification: Updated the build script to replace the
ABYSS_ASSETS_VERSIONenvironment variable during the bundling process, ensuring components use the correct CDN version. - Documentation Update:
docusaurus.config.jsuses webpack's DefinePlugin to replace theABYSS_ASSETS_VERSIONduring the build, aligning documentation with the current CDN version.
Future Considerations
- Mapping File: Post-release, consider creating a changelog or mapping file that correlates the versions of
abyss-webandabyss-mobilewithabyss-assetsversions to maintain clarity and ease troubleshooting.
Consequences
Pros
- Enables flexible and non-disruptive updates to assets.
- Prevents breaking changes for existing users when assets are updated.
- Aligns with best practices for managing static assets in software development.
Cons
- Requires additional management and oversight to maintain version synchronicity across different components and their dependencies.
Alternatives Considered
- Single Version Lifecycle: Continue with the unversioned approach. Rejected due to high risk of breaking changes and inflexibility.
References
- The implementation draft PR can be viewed here.
Revision History
- 10/4/2024: Initial draft