Fee for the number of container invocations, computing resources allocated to the application, and outgoing traffic (see Serverless Containers pricing).
Create a service account
You will use this service account to upload Docker images to registries in Yandex Container Registry and deploy containers to Serverless Containers.
On the left side of the screen, click the line with the name of the folder where you want to deploy your container.
In the list of services, select Identity and Access Management.
Click Create service account.
In the Name field, specify github-action.
Click Add role and select these roles:
container-registry.images.pusher: To work with Docker images in a registry.
serverless-containers.editor: To manage the container.
iam.serviceAccounts.user: To enable specifying a service account when creating a container revision. This account will be used to pull the Docker image from the registry.
Click Create.
Create a service account:
yc iam service-account create \
--name github-action
--folder-name <folder_name>
Assign the service account the following roles for the folder:
iam.serviceAccounts.user: To enable specifying a service account when creating a container revision. This account will be used to pull the Docker image from the registry:
Assign the service account these roles for the current folder:
iam.serviceAccounts.user: To enable specifying a service account when creating a container revision. This account will be used to pull the Docker image from the registry.
serverless-containers.editor: To manage the container.
container-registry.images.pusher: To work with Docker images in the registry.
Save the new registry’s ID, you will need it later.
Create a repository
The repository will be created from the yc-ci-cd-serverless template and store the Dockerfile, auxiliary files for creating the Docker image, and the CI/CD process settings.
In the window that opens, select Blank repository.
Under Your new repository details:
In the Owner field, select the organization in which you created the Yandex Cloud service account.
In the Name field, specify a name for the repository.
The name must be unique within the organization. The name may contain the following ASCII characters: lowercase and uppercase Latin letters, numbers, commas, hyphens, and underscores.
The address to access the repository at is displayed below the name.
Optionally, in the Description field, enter a description for the repository.
Under Repository template, click Browse templates, select the yc-ci-cd-serverless template, and click Use template.
To view the template contents, click Preview.
The template contains:
.sourcecraft/ci.yaml file with a pre-installed configuration of the CI/CD process that runs when a commit is created and does the following:
Obtains a Yandex Cloud IAM token using a service connection named default-service-connection.
Authenticates with Container Registry using the Docker Login GitHub Action and the Yandex Cloud IAM token.
Builds a Docker image from the Dockerfile located at the repository root and pushes it to Container Registry using the Build and Push Docker images GitHub Action.
Deploys a container in Serverless Containers from the built Docker image.
Select the organization where you created the Yandex Cloud service account.
On the organization page, in the Settings section, go to the Service connections section.
Click New service connection.
Under Basic information, specify the service connection name, default-service-connection.
Under Scope, select the repository you created earlier.
Under Yandex Cloud settings, select:
Folder where you previously deployed the cloud infrastructure and assigned a role to the service account.
github-action service account.
Tip
To re-request the list of clouds, folders, and service accounts from Yandex Cloud, click Synchronize. This can be of use if alongside creating a service connection you also created a folder or service account.
Click Create service connection.
Wait for the operation to complete. The page that opens will display the service connection details.
A Yandex Identity and Access Management workload identity federation will be automatically created in Yandex Cloud.
To view the parameters of the new OIDC provider, click the federation name under Workload identity federation.