Hello World

The primary goal of the Score Specification is to quickly and easily describe how to run a Workload. The following covers what you need to know to compose your first score.yaml file and run it with Humanitec.

Building blocks

At it’s core, the Score file needs a name and a container to run.

In the following example, the Score tab shows the minimum configuration needed to run a Workload and the Docker Compose tab shows the output of the humctl score deploy command.

The score.yaml file contains a Workload named hello-world and specifies a container image as busybox.

The following is the minimum configuration needed to run a Workload.

apiVersion: score.dev/v1b1
metadata:
  name: hello-world

containers:
  my-container:
    image: busybox

Containers

Notably, the busybox container image is not useful, because it exits immediately. You can set it to keep running by overriding the command and args of the container:

apiVersion: score.dev/v1b1
metadata:
  name: hello-world

containers:
  my-container:
    image: busybox
    command: ["/bin/sh"]
    args: ["-c", "while true; do echo Hello World!; sleep 5; done"]

Remember, to use the reference score-compose implementation during development to test a Score file on your local machine.

Deploying as a workload artefact

The humctl CLI can be used to upload the Score file as a Workload artefact.

humctl create artefact-version --type workload --name my-project/my-artefact --spec ./score.yaml

The output of humctl create artefact-version --help includes more options regarding source control metadata and versioning.

If there is an Artefact Automation Pipeline compatible with the artefact version properties, it will be triggered.

Deploying using humctl

The humctl Humanitec CLI can be used to convert the Score file into a delta and deploy it.

A deployment can be created using humctl score deploy -f ./score.yaml --env test-env.

Results You’ve successfully defined a Hello World Workload in score.yaml and created a Humanitec Deployment through the humctl Implementation.

Top