Zum Inhalt springen

Enable Actions in STACKIT Git

Diese Seite ist noch nicht in deiner Sprache verfügbar. Englische Seite aufrufen

Enable Actions using STACKIT centrally-managed runners

Section titled “Enable Actions using STACKIT centrally-managed runners”

STACKIT is now offering centrally-managed runners for your STACKIT Git actions. To start using them, please raise a new service request through the STACKIT Help Center clearly indicating what instance should have the runners enabled.
[Estimated response time: 2 days]

Once the STACKIT runner is setup, you will be notified via Support Ticket. The runner is configured with two tags: stackit-ubuntu-20 and stackit-docker.

  • stackit-ubuntu-20 is based on Ubuntu 20.04 and includes Node.js, which is suitable for most Github Actions.
  • stackit-docker includes a Docker tooling set with full Docker capabilities for building and pushing images. Note that this image has a larger footprint.

To make use of a specific runner tag, make sure to define the runs-on field in your workflow YAML accordingly.

Enable Actions using your own self-hosted runners

Section titled “Enable Actions using your own self-hosted runners”

STACKIT Git Actions provides Continuous Integration, with a web interface to show the results. The syntax and semantics of the workflow files will be familiar to people used to GitHub Actions but they are not and will never be identical.

The following guide explains key concepts to help understand how workflows are interpreted, with a set of examples that can be copy/pasted and modified to fit particular use cases.

  • Verify that Enable Repository Actions is checked.
  • Add the following to the .forgejo/workflows/demo.yaml file in the repository.
  • Go to the Actions tab of the /{owner}/{repository}/actions page of the repository to see the result of the run.
  • Click on the workflow link to see the details and the job execution logs.

In STACKIT Git terminology a workflow is a .yml file in the .forgejo/workflows directory of the repository. A workflow has jobs with steps to be executed by a Action runner.

An Action is a repository that contains the equivalent of a function in any programming language. It comes in two flavors, depending on the file found at the root of the repository:

  • action.yml: describes the inputs and outputs of the action and the implementation.
  • Dockerfile: if no action.yml file is found, it is used to create an image with docker build and run a container from it to carry out the action.

One of the most commonly used action is checkout which clones the repository that triggered a workflow. Another one is setup-go that will install Go.

Just as any other program or function, an Action has pre-requisites to successfully be installed and run. When looking at re-using an existing Action.

In a workflow file strings that look like ${{... }} are evaluated by the instane runner and are called expressions. As a shortcut, if: ${{... }} is equivalent to if:..., i.e the ${{ }} surrounding the expression is implicit and can be stripped.

  • boolean: true or false
  • null: null
  • number: any number format supported by JSON
  • string: enclosed in single quotes
OperatorDescription
( )Logical grouping
[ ]Index
.Property de-reference
!Not
<Less than
<=Less than or equal
>Greater than
>=Greater than or equal
==Equal
!=Not equal
&&And

NOTE: String comparisons are case insensitive.

Can be used in if: conditionals on jobs and steps.

  • success(). returns true when none of the previous jobs/steps have failed or been cancelled.
  • always(). causes the job/step to always execute, and returns true, even when cancelled. If you want to run a job/step regardless of its success or failure, use the recommended alternative: '!cancelled()' (the expression must be enclosed by quotes to not be interpreted as YAML tag).
  • failure(). returns true when any previous step/job has failed.
  • contains( search, item ). Returns true if search contains item. If search is an array, this function returns true if the item is an element in the array. If search is a string, this function returns true if the item is a substring of search. This function is not case sensitive. Casts values to a string.
  • startsWith( searchString, searchValue ). Returns true when searchString starts with searchValue. This function is not case sensitive. Casts values to a string.
  • endsWith( searchString, searchValue ). Returns true if searchString ends with searchValue. This function is not case sensitive. Casts values to a string.
  • format( string, replaceValue0, replaceValue1,..., replaceValueN). Replaces values in the string, with the variable replaceValueN. Variables in the string are specified using the {N} syntax, where N is an integer. You must specify at least one replaceValue and string. Escape curly braces using double braces.
  • join( array, optionalSeparator ). The value for array can be an array or a string. All values in array are concatenated into a string. If you provide optionalSeparator, it is inserted between the concatenated values. Otherwise, the default separator , is used. Casts values to a string.
  • toJSON(value). Returns a pretty-print JSON representation of value.
  • fromJSON(value). Returns a JSON object or JSON data type for value. You can use this function to provide a JSON object as an evaluated expression or to convert environment variables from a string.

STACKIT Git Pipelines are based on Forgejo. To find more information on how to get more value out of your pipelines, check the Forgejo documentation.