This article is now 2 years old! It is highly likely that this information is out of date and the author will have completely forgotten about it. Please take care when following any guidance to ensure you have up-to-date recommendations.
To generate a basic authentication header from a username and password in Code Stream you could use a CI task and execute echo -n username:password | base64 in the shell then export the result for use later on. A more repeatable way is to create a Custom Integration that takes the two inputs, and returns the encoded header as an output.
To create the Custom Integration:
Create a new Custom Integration named “Create Basic Authentication Header”
Select the Runtime - the examples below are shell and python3 respectively
Replace the placeholder code with the example from below
Save and version the Custom Integration, ensuring you eanble the “Release Version” toggle
Creating the Custom Integration
To use the Custom Integration in a pipeline:
Configure the Host (you’ll need a Docker endpoint configured for this) and Builder image URL settings in the Workspace tab of your pipeline (e.g. python:latest)
Add a new Custom task, to your Stage, select the “Create Basic Authentication Header” integration and configure the inputs
Use the tasks output.properties to refer to the header value in your later tasks - e.g. I’m using ${Stage0.Create Auth Header.output.properties.basicAuthHeader} to refer to the output in a REST task below:
Consuming the Custom Integration
Below are the shell and a Python3 examples, in the YAML format to paste into your custom integration: