Environment variable to create a file
We have project integrations that are pretty cool: you can enter in a few parameters and we'll turn them into useful variables to be consumed by CI/CD pipelines. Integrations can also do other things, but many times they're just wrappers for variables. That said, they have some downsides.. for example there can only be one of each type for a given project, and we had to move Kubernetes out of service integrations into their own page because of this. If we consider adding an AWS integration, we'd face the same challenge. Also, variables support "protection" so that their values are only present when used with protected branches. Wouldn't it be nice if the service integrations had those same capabilities? Well, rather than building in environment and protected filtering, what if we turned things around and just put the power into variables themselves.
This approach simplifies both the user experience as well as the back-end implementation. The existing service integration code is considered technical debt that we are looking to remove, and this facilitates that effort.
As MVC, we will create a "file" special variable type which creates a file in the runner build folder.
- Add a
typeto variables. Default variables would be key-value pairs, just like it works today.
- Allow users to set a variable name (
key) and content (
value) to the File variable.
- This will result in a file with a random filename created. The path to the file will be placed in the environment variable, and the contents of the file will be filled with the value.
This is expanded on next by creating an integration in this way, for AWS: #57780. The next iteration will prove out interesting features like validating the content of the variables in some interesting way.
- To improve usability, added labels on top of each input field to indicate what they represent in the 'Environments variables' section.
- Added Type dropdown button. User should be able to enter select the variable type.