Adding a Shell Stage
Shell stage allows you to run custom commands in the deployment pipeline. This stage can be added at any point in the deployment pipeline.
You must prepare a command specification YAML file containing all the steps that you want to run during the deployment. The command spec is run on a container instance host in the selected compartment and subnet in your tenancy. You have the option to choose different instance configuration before the deployment. See Shell Container Image Runtime Details. When you run the deployment pipeline, you can see the execution of the steps defined in the command spec in the pipeline output and logs. For syntax and example of the command spec, see Command Specification.
Key Benefits of Adding a Shell Stage
- Automate deployments to OCI platforms such as service mesh and container instances using OCI CLI and other pre-installed tools. See Shell Container Image Runtime Details.
OCI CLI is pre-authenticated to use the pipeline resource principal to access OCI resources.
- Run a database schema migration using command line tools such as Oracle SQL Developer Command Line (SQLcl).
- Use any pipeline parameters by referencing them in the spec. Also replace parameters and variables during the deployment run.
- Perform integration tests on artifacts before deploying to production.
- Customize the DevOps workflow. For example, you can wait for some resources to be ready before the pipeline deploys additional resources.
- Open the navigation menu and click Developer Services. Under DevOps, click Projects.
- Select a project, and click Create pipeline.
- Enter a name and description for the pipeline. Adding a description is optional.
- For Pipeline type, select Create a deployment pipeline.
- Click Create pipeline.
- To add a stage to the new pipeline, click the + icon and select Add stage.
- Select Integrations - Shell, and then click Next.
- Enter a name and optional description for the stage.
- Click Select Artifact, and then select available command specification artifact to deploy.
Select the compartment to create the container instance where the spec is run.
You can retain the default compartment that is displayed.
- Select an availability domain.
Select a shape for the container instance from the given options. You can also select the number of OCPUs and amount of memory for the instance.
You’re charged for the container instance (based on the selected compute shape) during the deployment based on the pricing model for container instances. See Container Instances Pricing.
Select a Virtual Cloud Network (VCN) and regional subnet in the tenancy. You can select public or private subnet.
When the command is run, a virtual network interface card (VNIC) is created in the selected subnet. Ensure that the subnet has a network path to the OCI Container Registry. If any command needs to manage other OCI resources, then this must also be handled to ensure that both the network path and policy are set up correctly.
- (Optional) For restricting access to your VCN, you can select Network security groups (NSGs) in your VCNs.
- (Optional) Enter a timeout value (in seconds) for the stage.
- (Optional) To add tags to the pipeline, click Show tagging options. Tagging is a metadata system that lets you organize and track the resources in your tenancy.
If you have permissions to create a resource, you also have permissions to add free-form tags to it.
To add a defined tag, you must have permissions to use the tag namespace.
For more information, see Resource Tags.
- To add the stage to the pipeline, click Add.
A stage preview provides a snapshot of the configuration.
Add more stages sequentially or in parallel to the pipeline, as needed. To deploy the build output to the target environment, run the deployment pipeline.
To create a deployment pipeline, run the
oci devops deploy-pipeline create --project-id
To create a Shell stage, run the
oci devops deploy-stage create-shell-stage
Required parameters for the
To get all the commands for
oci devops deploy-pipeline -h
oci devops deploy-stage -h
To get help for the
oci devops deploy-stage create-shell-stage -h