GitHub Action
YC Deploy Container to Instance Group
GitHub Action to deploy your container into Yandex Cloud instance group created from Container Optimized Image.
The action creates a Instance Group with the provided name in the provided folder if there is no one. Then it deploys a container using the provided image name and tag.
Table of Contents
- name: Login to Yandex Cloud Container Registry
id: login-cr
uses: yc-actions/yc-cr-login@v1
with:
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
- name: Build, tag, and push image to Yandex Cloud Container Registry
env:
CR_REGISTRY: crp00000000000000000
CR_REPOSITORY: my-cr-repo
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t cr.yandex/$CR_REGISTRY/$CR_REPOSITORY:$IMAGE_TAG .
docker push cr.yandex/$CR_REGISTRY/$CR_REPOSITORY:$IMAGE_TAG
- name: Deploy COI Instance Group
id: deploy-coi
uses: yc-actions/yc-coi-deploy-ig@v2
env:
CR_REGISTRY: crp00000000000000000
CR_REPOSITORY: my-cr-repo
IMAGE_TAG: ${{ github.sha }}
with:
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
folder-id: bbajn5q2d74c********
ig-spec-path: './spec.yaml'
user-data-path: './user-data.yaml'
docker-compose-path: './docker-compose.yaml'
Data from files ./spec.yaml
, user-data.yaml
, and docker-compose.yaml
will be passed to the Mustache template
renderer,
so there could be used environment variables substitution via {{ env.VARIABLE }}
syntax.
See action.yml for the full documentation for this action's inputs and outputs.
Important
If you want to be able to override the API endpoint, stick to v1
.
To perform this action, it is required that the service account on behalf of which we are acting has granted
the compute.admin
, vpc.admin
, and iam.serviceAccounts.user
roles or greater.
Also, you'll need to add loadbalancer.admin
if you use auto creating load balancer target groups via instance group
spec.
This code is made available under the MIT license.
In the IDE press cmd + ,
to open Preferences dialog.
- Then type
schema
in the search input - Select
JSON Schema Mappings
- Add new mapping
- Insert
https://raw.githubusercontent.com/yc-actions/yc-coi-deploy-ig/main/schema/CreateInstanceGroupRequest.json
into Schema file or URL input - Add file or pattern to apply the schema to.
Now you'll get some suggestions when you'll type. Also, param types are checked and errors are highlighted.