An open API service indexing awesome lists of open source software.

https://github.com/yc-actions/yc-coi-deploy-ig

GitHub Action to deploy your container into Yandex Cloud instance group created from Container Optimized Image.
https://github.com/yc-actions/yc-coi-deploy-ig

container-optimized-image deploy docker github-actions instance-group yandex-cloud

Last synced: 2 months ago
JSON representation

GitHub Action to deploy your container into Yandex Cloud instance group created from Container Optimized Image.

Awesome Lists containing this project

README

        

## GitHub Action to deploy your container into Yandex Cloud instance group created from Container Optimized Image.

[![Coverage](./badges/coverage.svg)](./badges/coverage.svg)

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**

- [Usage](#usage)
- [Permissions](#permissions)
- [License Summary](#license-summary)

## Usage

```yaml
- 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](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`.

## Permissions

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.

## License Summary

This code is made available under the MIT license.

## Adding schema validation for spec.yaml in JetBrains IDEs

In the IDE press `cmd + ,` to open Preferences dialog.

1. Then type `schema` in the search input
2. Select `JSON Schema Mappings`
3. Add new mapping
4. Insert `https://raw.githubusercontent.com/yc-actions/yc-coi-deploy-ig/main/schema/CreateInstanceGroupRequest.json`
into Schema file or URL input
5. Add file or pattern to apply the schema to.

![prefernces screenshot](schema/prefernces.png)

Now you'll get some suggestions when you'll type. Also, param types are checked and errors are highlighted.
![suggest](schema/suggest.png)