From 84f8c1285387d6683b9a32ab5ad96debfb6e238e Mon Sep 17 00:00:00 2001 From: Bohdan Sukhomlinov Date: Fri, 15 Mar 2024 19:25:30 +0200 Subject: [PATCH 1/2] 0.0.2 --- deployer/Dockerfile | 4 ++-- deployer/README.md | 34 +++++++++++++++++++++++++++++ deployer/{deploy.sh => deployer.sh} | 9 ++++---- 3 files changed, 41 insertions(+), 6 deletions(-) rename deployer/{deploy.sh => deployer.sh} (86%) diff --git a/deployer/Dockerfile b/deployer/Dockerfile index ff5dfb8..5a2379b 100644 --- a/deployer/Dockerfile +++ b/deployer/Dockerfile @@ -9,5 +9,5 @@ RUN apt update && \ RUN wget https://github.com/mikefarah/yq/releases/download/v4.27.5/yq_linux_amd64 -O /bin/yq && \ chmod +x /bin/yq -COPY deploy.sh deploy -ENTRYPOINT ["/app/deploy"] +COPY deployer.sh deployer +ENTRYPOINT ["/app/deployer"] diff --git a/deployer/README.md b/deployer/README.md index f9497ba..b931240 100644 --- a/deployer/README.md +++ b/deployer/README.md @@ -1 +1,35 @@ # Deployer - update k8s manifest and commit changes +This is ment to be part of CD proccess. +Will update k8s manifest in local repo with selected key-value and push changes to remote (where ArgoCD/Flux/other gitops will deploy) +Using `DEPLOY_KEY` will pull target repo + +## Usage + +### Args +`-f` -- file to be changed and commited +`-k` -- (key) - yaml path in -f(ile) to be changed +`-v` -- (value) - new values to be set for -k(ey) + +### Environment variables + +- `DEPLOY_KEY` -- plain ssh key to be used to commit + +## Examples + +### Argo Workflows + +```yaml + +``` + +## Tests + +```sh +./deployer.sh -f tests/test.yaml -k '.global.tag' -v testing +``` + +## TODO + +- [ ] Option to pull repo +- [ ] Set to which branch changes should be pushed +- [ ] create PR diff --git a/deployer/deploy.sh b/deployer/deployer.sh similarity index 86% rename from deployer/deploy.sh rename to deployer/deployer.sh index cd1885c..fc55e08 100755 --- a/deployer/deploy.sh +++ b/deployer/deployer.sh @@ -1,7 +1,7 @@ #!/bin/bash set -eu # DEPLOY_KEY=/app/.ssh/ssh.private -WORKDIR=/app/clone +WORKDIR="${WORKDIR:-/app/clone}" _help() { echo """ @@ -13,8 +13,8 @@ _help() { -v -- (value) - new values to be set for -k(ey) Envs: - DEPLOY_KEY - plain ssh key to be used to commit - + DEPLOY_KEY -- plain ssh key to be used to commit + WORKDIR -- optional, workdir to clone and commit changes """ } @@ -43,7 +43,8 @@ done git_config() { eval $(ssh-agent -s) - echo "${DEPLOY_KEY}" | tr -d '\r' | ssh-add - # TODO + # echo "${DEPLOY_KEY}" | tr -d '\r' | ssh-add - # TODO + ssh-add -i "${DEPLOY_KEY}" mkdir -p ~/.ssh chmod 700 ~/.ssh ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts From 4b89335634e4b4c9b35722015f3fb31c6892720b Mon Sep 17 00:00:00 2001 From: Bohdan Sukhomlinov Date: Sat, 16 Mar 2024 19:51:02 +0200 Subject: [PATCH 2/2] u --- mongodump/README.md | 47 --------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 mongodump/README.md diff --git a/mongodump/README.md b/mongodump/README.md deleted file mode 100644 index a7c8831..0000000 --- a/mongodump/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# Jenkins X CLI - -[![Documentation](https://godoc.org/github.com/jenkins-x/jx?status.svg)](https://pkg.go.dev/mod/github.com/jenkins-x/jx) -[![Go Report Card](https://goreportcard.com/badge/github.com/jenkins-x/jx)](https://goreportcard.com/report/github.com/jenkins-x/jx) -[![Releases](https://img.shields.io/github/release-pre/jenkins-x/jx.svg)](https://github.com/jenkins-x/jx/releases) -[![LICENSE](https://img.shields.io/github/license/jenkins-x/jx.svg)](https://github.com/jenkins-x/jx/blob/master/LICENSE) -[![Slack Status](https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack&style=social)](https://slack.k8s.io/) -[![codecov](https://codecov.io/gh/jenkins-x/jx/branch/main/graph/badge.svg?token=aBT7eQHx37)](https://codecov.io/gh/jenkins-x/jx) - -`jx` is the modular command line CLI for [Jenkins X 3.x](https://jenkins-x.io/v3/about/) - -## Commands - -See the [jx command reference](https://jenkins-x.io/v3/develop/reference/jx/) - -## Issues - -To track [issues in this repository](https://github.com/jenkins-x/jx/issues) and all the related [Plugins](#plugins) use these links: - -* [view open issues in jenkins-x-plugins](https://github.com/issues?q=is%3Aopen+is%3Aissue+author%3Ajstrachan+archived%3Afalse+user%3Ajenkins-x-plugins) -* [view open pull requests in jenkins-x-plugins](https://github.com/pulls?q=is%3Aopen+is%3Apr+archived%3Afalse+user%3Ajenkins-x-plugins+-label%3Adependencies) - -## Plugins - -You can browse the documentation for all of the `jx` plugins at: - -* [Plugin CLI Reference](https://jenkins-x.io/v3/develop/reference/jx/) -* [Plugin Source](https://github.com/jenkins-x-plugins) - - -## Components - -* [jx-git-operator](https://github.com/jenkins-x/jx-git-operator) is an operator for triggering jobs when git commits are made -* [octant-jx](https://github.com/jenkins-x/octant-jx) an open source Jenkins X UI for [vmware-tanzu/octant](https://github.com/vmware-tanzu/octant) - -## Libraries - -These are the modular libraries which have been refactored out of the main [jenkins-x/jx](https://github.com/jenkins-x/jx) repository as part of the [modularisation enhancement process](https://github.com/jenkins-x/enhancements/tree/master/proposals/5#1-overview) - -* [go-scm](https://github.com/jenkins-x/go-scm) API for working with SCM providers -* [jx-api](https://github.com/jenkins-x/jx-api) the core JX APIs -* [jx-helpers](https://github.com/jenkins-x/jx-helpers) a bunch of utilities (mostly from the `util` package) refactored + no longer dependent on [jenkins-x/jx](https://github.com/jenkins-x/jx/) -* [jx-kube-client](https://github.com/jenkins-x/jx-kube-client) the core library for working with kube/jx/tekton clients -* [jx-logging](https://github.com/jenkins-x/jx-logging) logging APIs -* [lighthouse-client](https://github.com/jenkins-x/lighthouse-client) client library for working with [lighthouse](https://github.com/jenkins-x/lighthouse) - -