Project with Stages

In Keptn, a project is a structure that allows organizing your services. A project is stored as a git repository and contains branches representing the multi-stage environment (e.g., dev, staging, and production stage). In other words, the separation of stage configurations is based on git repository branches.

Create a project

To create a project, you can use the CLI command keptn create project and pass a shipyard file.

Note: To learn more about the shipyard specification, please have a look at shipyard section and the the Keptn spec.

The simplest shipyard.yaml file with a single stage and no sequences defined would look like this:

apiVersion: spec.keptn.sh/0.2.2
kind: "Shipyard"
metadata:
  name: "shipyard-sockshop"
spec:
  stages:
    - name: "single-stage"
  • Recommended approach for Keptn in production: Create a project with the Keptn CLI using a Git upstream:

    keptn create project PROJECTNAME --shipyard=FILEPATH --git-user=GIT_USER --git-token=GIT_TOKEN --git-remote-url=GIT_REMOTE_URL
    

    See Git based upstream for more information.

  • Demo/Lab setting: Create a project with the Keptn CLI without a Git upstream and no backup:

    keptn create project PROJECTNAME --shipyard=FILEPATH
    

Delete a project

To delete a Keptn project, the keptn delete project command is provided:

  keptn delete project PROJECTNAME

Note: If a Git upstream is configured for this project, the referenced repository or project will not be deleted. Besides, deployed services are also not deleted by this command. To clean-up all resources created by Keptn, please go to Clean-up after deleting a project.

Update a project

Updating a project can either be achieved by deleting a project and creating the project with updated settings, or by adapting it directly in the Git upstream repository.

  • If you do not have a Git upstream set for your project, please set one since it is the recommended way of using Keptn: configure Git upstream.

  • If you do not have a Git repository to set an upstream, you can update the shipyard using:

  keptn add-resource --project=PROJECT --resource=./shipyard.yaml --resourceUri=./shipyard.yaml

⚠️ Only modify your shipyard in ways mentioned in this section.

⚠️ Make sure to have no running sequence while you are updating the shipyard. Otherwise, running sequences will be updated.

The following updates of shipyard.yaml are currently supported by Keptn:

  • Add/Remove a task to/from a task sequence
  • Add/Remove a task sequence to/from a stage
  • Define a trigger for a sequence

In contrast, the following updates are not supported by Keptn:

  • Add/Remove a stage

Please have a look at the shipyard section for more information regarding updating a shiypard file.