`runenv` create gcloud run deploy `--set-env-vars=` option and export shell environment from yaml file.

runenv

runenv create gcloud run deploy --set-env-vars= option and export shell environment from yaml file.

Motivation

I want to manage Cloud Run environment variables in a yaml file. But there is no way to pass the file to gcloud run deploy. Also, in gcloud services replace, it can manage environment variables in a yaml file, but it has to manage other values as well. In particular, we need to specify the revision, which is difficult to use.

Install

go install github.com/sonatard/runenv@latest

Usage

# env.yaml
- name: SERVER_KEY1
  value: value1
- name: SERVER_KEY2
  value: value2
$ runenv env.yaml
SERVER_KEY1=value1,SERVER_KEY2=value2

$ runenv -e env.yaml
export SERVER_KEY1="value1"
export SERVER_KEY2="value2"

Example

gcloud run deploy --set-env-vars

  1. Prepare revision config
gcloud run services describe [SERVICE] --format=export > service.yaml
  1. Create env.yaml from service.yaml
brew install yq
yq ".spec.template.spec.containers[].env" service.yaml > env.yaml

# or you can create env.yaml manualy.
# env.yaml
- name: SERVER_KEY1
  value: value1
- name: SERVER_KEY2
  value: value2
  1. Cloud run deploy with environment variables
gcloud run deploy [SERVICE] --image=[IMAGE] --set-env-vars="$(runenv env.yaml)"

Export shell environment

  1. Create env.yaml
# env.yaml
- name: SERVER_KEY1
  value: value1
- name: SERVER_KEY2
  value: value2
  1. Export shell environment
$ eval "$(runenv -e env.yaml)"
$ echo $SERVER_KEY1
value1
Similar Resources

A Go based deployment tool that allows the users to deploy the web application on the server using SSH information and pem file.

A Go based deployment tool that allows the users to deploy the web application on the server using SSH information and pem file. This application is intend for non tecnhincal users they can just open the GUI and given the server details just deploy.

Oct 16, 2021

webhook is a lightweight incoming webhook server to run shell commands

webhook is a lightweight incoming webhook server to run shell commands

What is webhook? webhook is a lightweight configurable tool written in Go, that allows you to easily create HTTP endpoints (hooks) on your server, whi

Jan 5, 2023

Docker-NodeJS - Creating a CI/CD Environment for Serverless Containers on Google Cloud Run

Docker-NodeJS - Creating a CI/CD Environment for Serverless Containers on Google Cloud Run

Creating a CI/CD Environment for Serverless Containers on Google Cloud Run Archi

Jan 8, 2022

Optional is a library that provides option types for Go types.

Option Optional is a library that provides option types for Go types. Installation Golang version 1.18 + required go get -u github.com/eatmoreapple/op

Nov 9, 2022

Library/tool to change a yaml given a rules file

golang-yaml-rules/yaml-transform Library/tool to change a yaml given a rules file Using jsonpath ( https://github.com/vmware-labs/yaml-jsonpath ), thi

Feb 11, 2022

Deploy, manage, and secure applications and resources across multiple clusters using CloudFormation and Shipa

CloudFormation provider Deploy, secure, and manage applications across multiple clusters using CloudFormation and Shipa. Development environment setup

Feb 12, 2022

Kubectl-over-env - Created for github actions or any other CI/CD-Pipelining tool which cannot push to a custom local kubernetes cluster

kubectl-over-env This repository was created for github actions or any other CI/

Jan 4, 2022

Nomad is an easy-to-use, flexible, and performant workload orchestrator that can deploy a mix of microservice, batch, containerized, and non-containerized applications

Nomad is an easy-to-use, flexible, and performant workload orchestrator that can deploy a mix of microservice, batch, containerized, and non-containerized applications

Nomad is an easy-to-use, flexible, and performant workload orchestrator that can deploy a mix of microservice, batch, containerized, and non-containerized applications. Nomad is easy to operate and scale and has native Consul and Vault integrations.

Jan 5, 2023

Small and easy server for web-hooks to deploy software on push from gitlab/github/hg and so on

Deployment mini-service This mini web-server is made to deploy your code without yaml-files headache. If you just need to update your code somewhere a

Dec 4, 2022
Comments
  • 同学,您这个项目引入了21个开源组件,存在2个漏洞,辛苦升级一下

    同学,您这个项目引入了21个开源组件,存在2个漏洞,辛苦升级一下

    检测到 sonatard/runenv 一共引入了21个开源组件,存在2个漏洞

    漏洞标题:Google Kubernetes API Server 资源管理错误漏洞
    缺陷组件:gopkg.in/[email protected]
    漏洞编号:CVE-2019-11254
    漏洞描述:Google Kubernetes是美国谷歌(Google)公司的一套开源的Docker容器集群管理系统。该系统为容器化的应用提供资源调度、部署运行、服务发现和扩容缩容等功能。API server是其中的一个API(应用编程接口)服务器。
    Google Kubernetes 1.15.10之前版本、1.16.7之前版本和1.17.3之前版本中的API Server组件存在资源管理错误漏洞。远程攻击者可借助特制请求利用该漏洞造成拒绝服务。
    国家漏洞库信息:https://www.cnvd.org.cn/flaw/show/CNVD-2020-35519
    影响范围:(∞, 2.2.8)
    最小修复版本:2.2.8
    缺陷组件引入路径:github.com/sonatard/runenv@->gopkg.in/[email protected]
    

    另外还有2个漏洞,详细报告:https://mofeisec.com/jr?p=aa3059

Related tags
Dotnet-appsettings-env - Convert .NET appsettings.json file to Kubernetes, Docker and Docker-Compose environment variables

dotnet-appsettings-env Convert .NET appsettings.json file to Kubernetes, Docker

Feb 16, 2022
Natural-deploy - A natural and simple way to deploy workloads or anything on other machines.

Natural Deploy Its Go way of doing Ansibles: Motivation: Have you ever felt when using ansible or any declarative type of program that is used for dep

Jan 3, 2022
Frep - Generate file using template from environment, arguments, json/yaml/toml config files

frep Generate file using template from environment, arguments, json/yaml/toml config files. NAME: frep - Generate file using template USAGE: fr

Nov 30, 2022
Testcontainers is a Golang library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.

When I was working on a Zipkin PR I discovered a nice Java library called Testcontainers. It provides an easy and clean API over the go docker sdk to

Jan 7, 2023
Witty - An unsafe web server to export shell to web
Witty - An unsafe web server to export shell to web

WiTTY: Web-based interactive TTY This program allows you to use terminal in the

Dec 30, 2022
Package create provides a generic option pattern for creating new values of any type

create Package create provides a generic option pattern for creating new values

Dec 30, 2021
Prestic - Lets you define and run restic commands from a YAML file

Pete's Restic Lets you define and run restic commands from a YAML file. Features

Jan 10, 2022
A tool to build, deploy, and release any environment using System Containers.
A tool to build, deploy, and release any environment using System Containers.

Bravetools Bravetools is an end-to-end System Container management utility. Bravetools makes it easy to configure, build, and deploy reproducible envi

Dec 14, 2022
K8s-dotenv - Kubernetes Secrets and Configmaps to dot env file

k8s-dotenv A commandline tool to fetch, merge and convert secrets and config map

Apr 22, 2022
Shell script to download and set GO environmental paths to allow multiple versions.
Shell script to download and set GO environmental paths to allow multiple versions.

gobrew gobrew lets you easily switch between multiple versions of go. It is based on rbenv and pyenv. Installation The automatic installer You can ins

Nov 3, 2022