Migrating from Peak SDK 0.0.6 to 1.0.0
Creation of Images and Webapps without YAML File
Starting from version 1.0.0 of the Peak SDK, we have introduced a new feature that allows you to create and update images, versions, and webapps without the need for a YAML file. Instead, you can directly pass the required parameters as arguments to the CLI command.
Here’s an example of creating an image using the new CLI syntax:
peak images create --name my-image --version 0.0.1 --type workflow --description awesome-image --source dockerfile --dockerfile "FROM nginx" --secrets secret_1 --secrets secret_2
This command will create the image body like following:
{
"name": "my-image",
"version": "0.0.1",
"type": "workflow",
"description": "awesome-image",
"buildDetails": {
"source": "dockerfile",
"dockerfile": "FROM nginx",
"secrets": ["secret_1", "secret_2"]
}
}
You can also combine the YAML template and command line arguments, where the command line arguments will take precedence over the YAML file. Consider the YAML template file with the following content:
# image.yaml.j2
body:
name: my-image
version: 0.0.1-test
type: workflow
description: Creating a new image
buildDetails:
source: github
repository: https://example.com
branch: main
useCache: true
You can create the image using the YAML template along with additional command line arguments:
peak images create path/to/image.yaml.j2 --name my-awesome-image
In this case, the final image body will look like:
{
"name": "my-awesome-image",
"version": "0.0.1-test",
"type": "workflow",
"description": "Creating a new image",
"buildDetails": {
"source": "github",
"repository": "https://example.com",
"branch": "main",
"useCache": true
}
}
For more detailed information on creating resources via the CLI, please refer to the CLI Usage Documentation.