goodsmileduck / yandex-serverless-action Goto Github PK
View Code? Open in Web Editor NEWGithub Action for deploying code to existed Serverless function in Yandex cloud
Github Action for deploying code to existed Serverless function in Yandex cloud
It would be very useful if we could update env variables settings during deploy together with updating actual code.
Пишу этот issue в 3 часа ночи, поэтому pr не сделал. Я предлагаю 2 простых изменения в коде, которые позволят сделать загружаемые на сервера яндекса архивы с функциями более чистыми
// Было
const fileContents = await zipDirectory(inputs);
// Стало
import { promises as fs } from "fs"
const fileContents = await (
inputs.source.endsWith('.zip')
? fs.readFile(inputs.source)
: zipDirectory(inputs)
)
await archive
// TODO: Добавить files в inputs и actions.yml
.glob(inputs.files ?? "**", {
cwd: inputs.source,
dot: true,
ignore: parseIgnoreGlobPatterns(inputs.sourceIgnore)
})
.finalize();
Удачи в развитии экшена
The requested feature: add parameter service-account-id
to the action.
Generally, it is expected that all the parameters described by yc serverless function version create --help
can be passed to the action.
Why it is important: when a service account is added to a function, it can receive IAM-tokens on each call and use them to call other APIs of Yandex.Cloud (e.g. translate API). This is very convenient e.g. for Alice skills using these APIs.
It would be very nice to have ability to add ignore filter for files that should be packed into the archive. For now, we need to explicitly copy the result to another folder that could be time-consuming.
In configuration section indicated that the parameter environment
not required. But if it is not passed, then there will be an error:
##[error]3 INVALID_ARGUMENT: Validation failed:
- environment[]: Field does not match the pattern /[a-zA-Z][a-zA-Z0-9_]*/
Не получается задеплоить функцию на go
Ошибка из YC
INVALID_ARGUMENT: Исходный архив не является валидным ZIP архивом
Yml файл
name: Push and Deploy Serverless function
on: push
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: goodsmileduck/yandex-serverless-action@v2
with:
token: ${{ secrets.TOKEN }}
function_id: "***"
runtime: "golang121"
entrypoint: "index.Handler"
exclude: "main.go"
environment: YDB_METADATA_CREDENTIALS=1
Файл логов github action
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: goodsmileduck/yandex-serverless-action@v2. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
yandex-serverless-action/entrypoint.sh
Line 53 in 22f7f17
Hi!
Function version uploaded into the cloud storage is being afterwards "created" with --source-path, which is wrong. Instead it should be created with --package-bucket-name and --package-object-name.
Would you be able to fix it? For my part, I could offer to make a pull request.
Thank you for such a great tool!
I use the latest version from master
:
- name: Deploy YF
uses: goodsmileduck/yandex-serverless-action@0cd492301916f9cbcbaeb68393f0a658a741ec44
env:
Build started failing today:
---> Using cache
---> 0917ee5e5cb1
Step 3/12 : RUN go get -u -v github.com/a8m/envsubst/cmd/envsubst
---> Using cache
---> 400461e63b09
Step 4/12 : FROM plugins/base:linux-amd64
---> 8c692aac9d91
Step 5/12 : LABEL maintainer="Serebrennikov Stanislav <[email protected]>" org.label-schema.name="Yandex Cloud function deploy" org.label-schema.vendor="Serebrennikov Stanislav" org.label-schema.schema-version="1.0"
---> Using cache
---> 8ce40c9424a0
Step 6/12 : ENV ZONE=ru-central1-a MEMORY=128m TIMEOUT=5s
---> Using cache
---> 3dc188637f23
Step 7/12 : COPY --from=builder /go/bin/envsubst /bin/envsubst
---> Using cache
---> 524dfdb0ae28
Step 8/12 : RUN apk add curl bash python py-pip zip && curl https://storage.yandexcloud.net/yandexcloud-yc/install.sh | bash && pip install awscli && ln -s /root/yandex-cloud/bin/yc /bin/yc
---> Running in b054555413e5
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
fetch http://nl.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
python (missing):
required by: world[python]
The command '/bin/sh -c apk add curl bash python py-pip zip && curl https://storage.yandexcloud.net/yandexcloud-yc/install.sh | bash && pip install awscli && ln -s /root/yandex-cloud/bin/yc /bin/yc' returned a non-zero code: 1
##[error]Docker build failed with exit code 1
Yandex have a list of allowed args for runtime
property.
Be nicely to have this link in README.md near with runtime
property description
Please, add more information about exclude patterns in README. I found out from code, that several patterns could be written comma separated. Also it would be nice, if you say something about pattern syntax - Is it regex or something simplier?
Hi there!
I appreciate your work; it helps me run a lot of lambdas and works like a charm!
However, yandex-serverless-action@v2 doesn't seem to work.
This is my action:
- uses: goodsmileduck/yandex-serverless-action@v2
with:
token: ${{ secrets.YC_TOKEN }}
function_id: ${{ secrets.YC_FUNCTION_ID }}
service_account: ${{ secrets.YC_SERVICE_ACCOUNT }}
bucket: ${{ secrets.YC_BUCKET }}
accessKeyId: ${{ secrets.ACCESS_KEY_ID }}
secretAccessKey: ${{ secrets.SECRET_ACCESS_KEY }}
runtime: 'python311'
memory: '1024'
execution_timeout: '15'
entrypoint: 'ycloud.handler'
environment: VAR1=${{ secrets.VAR1 }},VAR2=${{ secrets.VAR2 }},VAR3=${{ secrets.VAR3 }}
source: 'app'
This is success log of execution (in 2 seconds):
Run goodsmileduck/yandex-serverless-action@v2
with:
token: ***
function_id: ***
service_account: ***
bucket: ***
accessKeyId: ***
secretAccessKey: ***
runtime: python311
memory: 1024
execution_timeout: 15
entrypoint: ycloud.handler
environment: VAR1=***,VAR2=***,VAR3=***
source: app
Function inputs set
::group::ZipDirectory
ZipDirectory
Archive initialize
Source ignore pattern: "[]"
When I looked at the developer console, I saw no new version of lambda deployed. I didn't see any new archive in Object Storage either.
But if I change v2 to v1 - it works as expected. Here is the success log (31 seconds):
Warning: Unexpected input(s) 'accessKeyId', 'secretAccessKey', valid inputs are ['description', 'token', 'function_id', 'bucket', 'runtime', 'entrypoint', 'source', 'exclude', 'memory', 'environment', 'execution_timeout', 'service_account']
Run goodsmileduck/yandex-serverless-action@v1
Function inputs set
::group::ZipDirectory
ZipDirectory
Buffer size: 59809425b
Upload to bucket: "***/***/***.zip"
::group::Get function by ID: "***"
Get function by ID: "***"
::group::Create function version
Create function version
::set-output name=time::09:54:35 GMT+0000 (Coordinated Universal Time)
Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
I know that it's not the best bug description, but that's all I have. It's not a blocker for me as well - I continue using v1 and it's cover 100% of my requirements.
If I deploy more than one YF in a single GH workflow, files from the first deployed function appear in second function. Probably need to clean up SOURCE_DIR
before zipping/deployment.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.