{"id":306122,"date":"2020-06-29T15:01:47","date_gmt":"2020-06-29T15:01:47","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=306122"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=306122","title":{"rendered":"\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0443\u044e feature branch \u0432 Kubernetes \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/508534\/\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vm\/lu\/1i\/vmlu1idc6dy6fzcyzuem8p9dl5i.png\"><\/div>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! <b>Feature branch<\/b> (aka deploy preview, review app) \u2014 \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0434\u0435\u043f\u043b\u043e\u0438\u0442\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e master \u0432\u0435\u0442\u043a\u0430, \u043d\u043e \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 pull request \u043d\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 URL. \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043b\u0438 \u043a\u043e\u0434 \u0432 production-\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438, \u0444\u0438\u0447\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c \u0438\u043b\u0438 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u043b\u043e\u0433\u0430\u043c. \u041f\u043e\u043a\u0430 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0432 pull request&#8217;\u0435, \u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u0432\u044b\u0439 commit \u0442\u0435\u043a\u0443\u0449\u0438\u0439 deploy \u0434\u043b\u044f \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f, \u0430 \u043d\u043e\u0432\u044b\u0439 deploy \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432\u044b\u043a\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u0412\u043e\u043f\u0440\u043e\u0441\u044b \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0441\u043c\u0435\u0440\u0434\u0436\u0438\u043b\u0438 pull request \u0432 master \u0432\u0435\u0442\u043a\u0443. Feature branch \u0432\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u0430, \u043d\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u044b Kubernetes \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0415\u0449\u0435 \u043f\u0440\u043e feature branch&#8217;\u0438<\/h2>\n<p>  <\/p>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c feature branch&#8217;\u0438 \u0432 Kubernetes \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c namespace&#8217;\u044b. \u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e, production \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">kind: Namespace apiVersion: v1 metadata:   name: habr-back-end ...  kind: Deployment apiVersion: apps\/v1 metadata:   namespace: habr-back-end spec:   replicas: 3 ...<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f feature branch \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f namespace c \u0435\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u043e\u043c\u0435\u0440 pull request&#8217;\u0430) \u0438 \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u043c\/\u043f\u043e\u0441\u0442\u0444\u0438\u043a\u0441\u043e\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <b>-pr-<\/b>):<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">kind: Namespace apiVersion: v1 metadata:   name: habr-back-end-pr-17 ...  kind: Deployment apiVersion: apps\/v1 metadata:   namespace: habr-back-end-pr-17 spec:   replicas: 1 ...<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c, \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b <b>Kubernetes Operator<\/b> (\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430), <a href=\"https:\/\/github.com\/dmytrostriletskyi\/stale-feature-branch-operator\" rel=\"nofollow\">\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 Github<\/a>. \u041e\u043d \u0443\u0434\u0430\u043b\u044f\u0435\u0442 namespace&#8217;\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u0441\u0442\u0430\u0440\u044b\u043c feature branch&#8217;\u0430\u043c. \u0412 Kubernetes, \u0435\u0441\u043b\u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c namespace, \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0432 \u044d\u0442\u043e\u043c namespace \u0442\u0430\u043a\u0436\u0435 \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ kubectl get pods --all-namespaces | grep -e &quot;-pr-&quot; NAMESPACE            ... AGE habr-back-end-pr-264 ... 4d8h habr-back-end-pr-265 ... 5d7h<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e \u0442\u043e \u043a\u0430\u043a \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c feature branch&#8217;\u0438 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/itnext.io\/feature-deployments-in-kubernetes-c74bdcff0d8e\" rel=\"nofollow\">\u0442\u0443\u0442<\/a> \u0438 <a href=\"https:\/\/codefresh.io\/kubernetes-tutorial\/dynamically-creating-k8s-namespaces-every-branch-pull-request-2\" rel=\"nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>  <\/p>\n<h2>\u041c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f<\/h2>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b pull request&#8217;a \u0441 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0435\u0439 (<code>continuous integration<\/code>):<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u0443\u0448\u0438\u043c \u043d\u043e\u0432\u044b\u0439 commit \u0432 \u0432\u0435\u0442\u043a\u0443.<\/li>\n<li>\u041d\u0430 \u0431\u0438\u043b\u0434\u0435, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043b\u0438\u043d\u0442\u0435\u0440\u044b \u0438\/\u0438\u043b\u0438 \u0442\u0435\u0441\u0442\u044b.<\/li>\n<li>\u041d\u0430 \u043b\u0435\u0442\u0443 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 Kubernetes pull request&#8217;a (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u043d\u043e\u043c\u0435\u0440).<\/li>\n<li>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e kubectl apply \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 (deploy).<\/li>\n<li>Pull request \u0441\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 master \u0432\u0435\u0442\u043a\u0443.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041f\u043e\u043a\u0430 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0432 pull request&#8217;\u0435, \u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u0432\u044b\u0439 commit \u0442\u0435\u043a\u0443\u0449\u0438\u0439 deploy \u0434\u043b\u044f \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f, \u0430 \u043d\u043e\u0432\u044b\u0439 deploy \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432\u044b\u043a\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u041d\u043e \u043a\u043e\u0433\u0434\u0430 pull request \u0441\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 master \u0432\u0435\u0442\u043a\u0443, \u0431\u0443\u0434\u0435\u0442 \u0431\u0438\u043b\u0434\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e master \u0432\u0435\u0442\u043a\u0430. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043f\u0440\u043e pull request \u043c\u044b \u0443\u0436\u0435 \u0437\u0430\u0431\u044b\u043b\u0438, \u0430 \u0435\u0433\u043e Kubernetes \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435.<\/p>\n<p>  <\/p>\n<h2>\u041a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<\/h2>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 \u043d\u0438\u0436\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ kubectl apply -f https:\/\/raw.githubusercontent.com\/dmytrostriletskyi\/stale-feature-branch-operator\/master\/configs\/production.yml<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435\u043c \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <code>kubectl apply -f<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: feature-branch.dmytrostriletskyi.com\/v1 kind: StaleFeatureBranch metadata:   name: stale-feature-branch spec:   namespaceSubstring: -pr-   afterDaysWithoutDeploy: 3<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <b>namespaceSubstring<\/b> \u043d\u0443\u0436\u0435\u043d, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c namespace&#8217;\u044b \u0434\u043b\u044f pull request&#8217;\u043e\u0432 \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 namespace&#8217;\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 namespace&#8217;\u044b: <code>habr-back-end<\/code>, <code>habr-front-end<\/code>, <code>habr-back-end-pr-17<\/code>, <code>habr-back-end-pr-33<\/code>, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430\u043c\u0438 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0443\u0442 <code>habr-back-end-pr-17<\/code>, <code>habr-back-end-pr-33<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <b>afterDaysWithoutDeploy<\/b> \u043d\u0443\u0436\u0435\u043d \u0447\u0442\u043e\u0431\u044b, \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435 namespace&#8217;\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 namespace \u0441\u043e\u0437\u0434\u0430\u043d <code>3 \u0434\u043d\u044f 1 \u0447\u0430\u0441<\/code> \u043d\u0430\u0437\u0430\u0434, \u0430 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e <code>3 \u0434\u043d\u044f<\/code>, \u044d\u0442\u043e\u0442 namespace \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443, \u0435\u0441\u043b\u0438 namespace \u0441\u043e\u0437\u0434\u0430\u043d <code>2 \u0434\u043d\u044f 23 \u0447\u0430\u0441\u0430<\/code> \u043d\u0430\u0437\u0430\u0434, \u0430 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e <code>3 \u0434\u043d\u044f<\/code>, \u044d\u0442\u043e\u0442 namespace \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043e\u043d \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0442\u043e \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 namespace&#8217;\u044b \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0430 \u0434\u043d\u0438 \u0431\u0435\u0437 deploy&#8217;\u044f \u2014 <b>checkEveryMinutes<\/b>. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d \u0440\u0430\u0432\u0435\u043d <code>30 \u043c\u0438\u043d\u0443\u0442\u0430\u043c<\/code>.<\/p>\n<p>  <\/p>\n<h2>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h2>\n<p>  <\/p>\n<p>\u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f:<\/p>\n<p>  <\/p>\n<ol>\n<li><a href=\"https:\/\/docs.docker.com\/get-docker\" rel=\"nofollow\">Docker<\/a> \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438.<\/li>\n<li><a href=\"https:\/\/kubernetes.io\/docs\/tasks\/tools\/install-minikube\" rel=\"nofollow\">Minikube<\/a> \u043f\u043e\u0434\u043d\u0438\u043c\u0435\u0442 Kubernetes \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e.<\/li>\n<li><a href=\"https:\/\/kubernetes.io\/docs\/tasks\/tools\/install-kubectl\" rel=\"nofollow\">kubectl<\/a> \u2014 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u043c.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u043c Kubernetes \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ minikube start --vm-driver=docker minikube v1.11.0 on Darwin 10.15.5 Using the docker driver based on existing profile. Starting control plane node minikube in cluster minikube.<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c <code>kubectl<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ kubectl config use-context minikube Switched to context &quot;minikube&quot;.<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f production-\u0441\u0440\u0435\u0434\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ curl https:\/\/raw.githubusercontent.com\/dmytrostriletskyi\/stale-feature-branch-operator\/master\/configs\/production.yml &gt; stale-feature-branch-production-configs.yml<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a production \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435 namespace&#8217;\u044b, \u0430 \u0432 \u043d\u0430\u0448\u0435\u043c \u043d\u043e\u0432\u043e \u043f\u043e\u0434\u043d\u044f\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u0438\u0445 \u043d\u0435\u0442, \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f <code>IS_DEBUG<\/code> \u043d\u0430 <code>true<\/code>. \u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>afterDaysWithoutDeploy<\/code> \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438 namespace&#8217;\u044b \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u0434\u043d\u0438 \u0431\u0435\u0437 deploy&#8217;\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0438 (<code>-pr-<\/code>).<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0430 <code>Linux<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ sed -i 's|false|true|g' stale-feature-branch-production-configs.yml<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0430 <code>macOS<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ sed -i &quot;&quot; 's|false|true|g' stale-feature-branch-production-configs.yml<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ kubectl apply -f stale-feature-branch-production-configs.yml<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0440\u0435\u0441\u0443\u0440\u0441 <code>StaleFeatureBranch<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ kubectl api-resources | grep stalefeaturebranches NAME                 ... APIGROUP                             ... KIND stalefeaturebranches ... feature-branch.dmytrostriletskyi.com ... StaleFeatureBranch<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ kubectl get pods --namespace stale-feature-branch-operator NAME                                           ... STATUS  ... AGE stale-feature-branch-operator-6bfbfd4df8-m7sch ... Running ... 38s<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0432 \u0435\u0433\u043e \u043b\u043e\u0433\u0438, \u043e\u043d \u0433\u043e\u0442\u043e\u0432 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u044b <code>StaleFeatureBranch<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ kubectl logs stale-feature-branch-operator-6bfbfd4df8-m7sch -n stale-feature-branch-operator ... &quot;msg&quot;:&quot;Operator Version: 0.0.1&quot;} ... ... &quot;msg&quot;:&quot;Starting EventSource&quot;, ... , &quot;source&quot;:&quot;kind source: \/, Kind=&quot;} ... &quot;msg&quot;:&quot;Starting Controller&quot;, ...} ... &quot;msg&quot;:&quot;Starting workers&quot;, ..., &quot;worker count&quot;:1}<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 <code>fixtures<\/code> (\u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430) \u0434\u043b\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u0430 <code>StaleFeatureBranch<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ kubectl apply -f https:\/\/raw.githubusercontent.com\/dmytrostriletskyi\/stale-feature-branch-operator\/master\/fixtures\/stale-feature-branch.yml<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u0445 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0438\u0441\u043a\u0430\u0442\u044c namespace&#8217;\u044b \u0441 \u043f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u043e\u0439 <code>-pr-<\/code> \u0440\u0430\u0437 \u0432 <code>1 \u043c\u0438\u043d\u0443\u0442\u0443<\/code>.:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apiVersion: feature-branch.dmytrostriletskyi.com\/v1 kind: StaleFeatureBranch metadata:   name: stale-feature-branch spec:   namespaceSubstring: -pr-   afterDaysWithoutDeploy: 1    checkEveryMinutes: 1<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u043e\u0442\u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043b \u0438 \u0433\u043e\u0442\u043e\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c namespace&#8217;\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ kubectl logs stale-feature-branch-operator-6bfbfd4df8-m7sch -n stale-feature-branch-operator ... &quot;msg&quot;:&quot;Stale feature branch is being processing.&quot;,&quot;namespaceSubstring&quot;:&quot;-pr-&quot;,&quot;afterDaysWithoutDeploy&quot;:1,&quot;checkEveryMinutes&quot;:1,&quot;isDebug&quot;:&quot;true&quot;}<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c <code>fixtures<\/code>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435 \u0434\u0432\u0430 namespace&#8217;\u0430 (<code>project-pr-1<\/code>, <code>project-pr-2<\/code>) \u0438 \u0438\u0445 <code>deployments<\/code>, <code>services<\/code>, <code>ingress<\/code>, \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ kubectl apply -f https:\/\/raw.githubusercontent.com\/dmytrostriletskyi\/stale-feature-branch-operator\/master\/fixtures\/first-feature-branch.yml -f https:\/\/raw.githubusercontent.com\/dmytrostriletskyi\/stale-feature-branch-operator\/master\/fixtures\/second-feature-branch.yml ... namespace\/project-pr-1 created deployment.apps\/project-pr-1 created service\/project-pr-1 created horizontalpodautoscaler.autoscaling\/project-pr-1 created secret\/project-pr-1 created configmap\/project-pr-1 created ingress.extensions\/project-pr-1 created namespace\/project-pr-2 created deployment.apps\/project-pr-2 created service\/project-pr-2 created horizontalpodautoscaler.autoscaling\/project-pr-2 created secret\/project-pr-2 created configmap\/project-pr-2 created ingress.extensions\/project-pr-2 created<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0432\u044b\u0448\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ kubectl get namespace,pods,deployment,service,horizontalpodautoscaler,configmap,ingress -n project-pr-1 &amp;&amp; kubectl get namespace,pods,deployment,service,horizontalpodautoscaler,configmap,ingress -n project-pr-2 ... NAME                              ... READY ... STATUS  ... AGE pod\/project-pr-1-848d5fdff6-rpmzw ... 1\/1   ... Running ... 67s  NAME                         ... READY ... AVAILABLE ... AGE deployment.apps\/project-pr-1 ... 1\/1   ... 1         ... 67s ...<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u043b\u0438 <code>debug<\/code>, namespace&#8217;\u044b <code>project-pr-1<\/code> \u0438 <code>project-pr-2<\/code>, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u0443\u0434\u0443\u0442 \u0441\u0440\u0430\u0437\u0443 \u0443\u0434\u0430\u043b\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>afterDaysWithoutDeploy<\/code>. \u0412 \u043b\u043e\u0433\u0430\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u044d\u0442\u043e \u0432\u0438\u0434\u043d\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ kubectl logs stale-feature-branch-operator-6bfbfd4df8-m7sch -n stale-feature-branch-operator ... &quot;msg&quot;:&quot;Namespace should be deleted due to debug mode is enabled.&quot;,&quot;namespaceName&quot;:&quot;project-pr-1&quot;} ... &quot;msg&quot;:&quot;Namespace is being processing.&quot;,&quot;namespaceName&quot;:&quot;project-pr-1&quot;,&quot;namespaceCreationTimestamp&quot;:&quot;2020-06-16 18:43:58 +0300 EEST&quot;} ... &quot;msg&quot;:&quot;Namespace has been deleted.&quot;,&quot;namespaceName&quot;:&quot;project-pr-1&quot;} ... &quot;msg&quot;:&quot;Namespace should be deleted due to debug mode is enabled.&quot;,&quot;namespaceName&quot;:&quot;project-pr-2&quot;} ... &quot;msg&quot;:&quot;Namespace is being processing.&quot;,&quot;namespaceName&quot;:&quot;project-pr-2&quot;,&quot;namespaceCreationTimestamp&quot;:&quot;2020-06-16 18:43:58 +0300 EEST&quot;} ... &quot;msg&quot;:&quot;Namespace has been deleted.&quot;,&quot;namespaceName&quot;:&quot;project-pr-2&quot;}<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432 \u0441\u0442\u0430\u0442\u0443\u0441\u0435 <code>Terminating<\/code> (\u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f) \u0438\u043b\u0438 \u0443\u0436\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u044b (\u0432\u044b\u0432\u043e\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u0443\u0441\u0442).<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">$ kubectl get namespace,pods,deployment,service,horizontalpodautoscaler,configmap,ingress -n project-pr-1 &amp;&amp; kubectl get namespace,pods,deployment,service,horizontalpodautoscaler,configmap,ingress -n project-pr-2 ...<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <code>fixtures<\/code> \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u044b \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043c\u0438\u043d\u0443\u0442\u044b.<\/p>\n<p>  <\/p>\n<h2>\u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b<\/h2>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435? \u041f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u0432\u0441\u0435 \u043e\u043d\u0438 \u043d\u0435\u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b (\u0438 \u0438\u0445 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u0441\u0443\u0431\u044a\u0435\u043a\u0442\u0438\u0432\u043d\u044b), \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0430\u043c \u0440\u0435\u0448\u0430\u0435\u0442 \u0447\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435:<\/p>\n<p>  <\/p>\n<ol>\n<li>\n<p>\u0423\u0434\u0430\u043b\u044f\u0442\u044c feature branch \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0431\u0438\u043b\u0434\u0430 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 master \u0432\u0435\u0442\u043a\u0438.<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439 pull request \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a commit&#8217;\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0438\u043b\u0434\u0438\u0442\u0441\u044f. \u0422\u0430\u043a \u043a\u0430\u043a feature branch namespace \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 pull request&#8217;a \u2014 \u0435\u0433\u043e \u043d\u043e\u043c\u0435\u0440, \u0438\u043b\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0432\u0435\u0442\u043a\u0438, \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432 commit&#8217;e.<\/li>\n<li>\u0411\u0438\u043b\u0434\u044b master \u0432\u0435\u0442\u043e\u043a \u0444\u0435\u0439\u043b\u044f\u0442\u0441\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u0432\u0430\u0441 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u044d\u0442\u0430\u043f\u044b: \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u044b, \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0435\u043b\u0438\u0437, \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f, \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c feature branch \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e pull request&#8217;a. \u0415\u0441\u043b\u0438 \u0431\u0438\u043b\u0434 \u0441\u0444\u0435\u0439\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f, \u0432\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0432\u0441\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u0440\u0443\u043a\u0430\u043c\u0438.<\/li>\n<li>\u0411\u0435\u0437 \u0434\u043e\u043b\u0436\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 feature branch&#8217;\u0438 \u0432 master \u0431\u0438\u043b\u0434\u0435 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e.<\/li>\n<\/ul>\n<p>  <\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 webhook&#8217;\u043e\u0432 (<a href=\"https:\/\/github.community\/t\/trigger-jenkins-job-when-a-pull-request-is-merged-to-a-branch\/1169\" rel=\"nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440<\/a>).<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044d\u0442\u043e \u043d\u0435 \u0432\u0430\u0448 \u043f\u043e\u0434\u0445\u043e\u0434. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 <a href=\"https:\/\/www.jenkins.io\" rel=\"nofollow\">Jenkins<\/a>, \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0432\u0438\u0434 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435. \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 webhook&#8217;\u043e\u0432 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u042d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 Jenkins&#8217;\u0430, \u0447\u0442\u043e \u0442\u0440\u0443\u0434\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c.<\/li>\n<\/ul>\n<p>  <\/li>\n<li>\n<p>\u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/workloads\/controllers\/cron-jobs\/\" rel=\"nofollow\">Cronjob<\/a> \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c Kubernetes \u043a\u043b\u0430\u0441\u0442\u0435\u0440.<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0417\u0430\u0442\u0440\u0430\u0442\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443.<\/li>\n<li>\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0443\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435, \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/li>\n<\/ul>\n<p>  <\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043a \u0441\u0442\u0430\u0442\u044c\u0435. <strong><a href=\"https:\/\/github.com\/dmytrostriletskyi\/stale-feature-branch-operator\" rel=\"nofollow\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 Github<\/a><\/strong>.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/508534\/\"> https:\/\/habr.com\/ru\/post\/508534\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/508534\/\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vm\/lu\/1i\/vmlu1idc6dy6fzcyzuem8p9dl5i.png\"><\/div>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! <b>Feature branch<\/b> (aka deploy preview, review app) \u2014 \u044d\u0442\u043e \u043a\u043e\u0433\u0434\u0430 \u0434\u0435\u043f\u043b\u043e\u0438\u0442\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e master \u0432\u0435\u0442\u043a\u0430, \u043d\u043e \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 pull request \u043d\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 URL. \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043b\u0438 \u043a\u043e\u0434 \u0432 production-\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438, \u0444\u0438\u0447\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c \u0438\u043b\u0438 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u043b\u043e\u0433\u0430\u043c. \u041f\u043e\u043a\u0430 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0432 pull request&#8217;\u0435, \u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u0432\u044b\u0439 commit \u0442\u0435\u043a\u0443\u0449\u0438\u0439 deploy \u0434\u043b\u044f \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f, \u0430 \u043d\u043e\u0432\u044b\u0439 deploy \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432\u044b\u043a\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u0412\u043e\u043f\u0440\u043e\u0441\u044b \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0441\u043c\u0435\u0440\u0434\u0436\u0438\u043b\u0438 pull request \u0432 master \u0432\u0435\u0442\u043a\u0443. Feature branch \u0432\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u0430, \u043d\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u044b Kubernetes \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-306122","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=306122"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306122\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=306122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=306122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=306122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}