Skip to content

Commit

Permalink
chore: adopting new microservice pattern in ci (#489)
Browse files Browse the repository at this point in the history
  • Loading branch information
johndietz authored Aug 2, 2024
1 parent 88a6404 commit f1d646a
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 79 deletions.
59 changes: 13 additions & 46 deletions .argo/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ spec:
value: '{{steps.get-initial-chart-version.outputs.result}}-rc.{{workflow.parameters.shortSha}}'
- name: shortSha
value: '{{workflow.parameters.shortSha}}'
- - name: publish-helm-chart
- - name: publish-helm-chart #! mini chart
templateRef:
name: cwft-helm
template: publish-chart
Expand Down Expand Up @@ -126,69 +126,36 @@ spec:
value: charts # sets workingDir
- name: chartDir
value: 'charts/kubefirst'
- - name: output-current-chart-version

- - name: get-current-macro-chart-version
templateRef:
name: cwft-helm
template: output-macro-chart-version
template: get-macro-chart-version
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.helm-dependency-update.outputs.artifacts.repo-source}}'
from: '{{steps.set-app-version-and-bump-macro-chartz.outputs.artifacts.repo-source}}'
parameters:
- name: appName
value: "charts"
- name: chartDir
value: "charts/kubefirst"
- name: version
value: "current"
- - name: pull-commit-push-charts

- - name: pull-commit-push-tag-charts
templateRef:
name: cwft-git
template: pull-commit-push
template: pull-commit-push-tag
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.helm-dependency-update.outputs.artifacts.repo-source}}'
from: '{{steps.set-app-version-and-bump-macro-chartz.outputs.artifacts.repo-source}}'
parameters:
- name: commitMessage
value: 'prepared next macro chart for kubefirst - set {{workflow.parameters.appName}} to {{steps.get-initial-chart-version.outputs.result}}-rc.{{workflow.parameters.shortSha}}'
value: 'tagged {{workflow.parameters.appName}} in charts kubefirst-v{{steps.get-current-macro-chart-version.outputs.result}}'
- name: gitUrlNoProtocol
value: '{{workflow.parameters.gitUrlNoProtocol}}'
- name: repoName
value: 'charts'
- - name: pull-sign-commit-push-gitops-template
templateRef:
name: cwft-git
template: pull-sign-commit-push-gitops-template
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.helm-dependency-update.outputs.artifacts.repo-source}}'
parameters:
- name: appName
value: 'gitops-template'
- name: commitMessage
value: 'set next macro chart for kubefirst - {{steps.output-current-chart-version.outputs.result}}'
- name: nextChartVersion
value: "{{steps.output-current-chart-version.outputs.result}}"
- - name: pull-sign-commit-push-gitops
templateRef:
name: cwft-git
template: pull-sign-commit-push-gitops
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.helm-dependency-update.outputs.artifacts.repo-source}}'
parameters:
- name: appName
value: 'gitops'
- name: commitMessage
value: 'set next macro chart for kubefirst - {{steps.output-current-chart-version.outputs.result}}'
- name: chartVersion
value: "{{steps.output-current-chart-version.outputs.result}}"
- name: environment
value: "development"
- name: tag
value: 'kubefirst-v{{steps.get-current-macro-chart-version.outputs.result}}'

112 changes: 79 additions & 33 deletions .argo/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,38 +81,6 @@ spec:
value: '{{workflow.parameters.appName}}'
- name: tagName
value: '{{steps.get-initial-chart-version.outputs.result}}'
- - name: set-environment-version
templateRef:
name: cwft-helm
template: set-environment-version
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.checkout.outputs.artifacts.repo-source}}'
parameters:
- name: fullChartPath
value: 'registry/{{workflow.parameters.clusterName}}/components/{{workflow.parameters.environment}}/{{workflow.parameters.appName}}/Chart.yaml'
- name: chartVersion
value: '{{steps.get-initial-chart-version.outputs.result}}'
- name: environment
value: '{{workflow.parameters.environment}}'
- - name: commit-production
templateRef:
name: cwft-git
template: pull-commit-push
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.set-environment-version.outputs.artifacts.repo-source}}'
parameters:
- name: repoName
value: 'gitops'
- name: gitUrlNoProtocol
value: '{{workflow.parameters.gitUrlNoProtocol}}'
- name: commitMessage
value: 'setting {{workflow.parameters.appName}} {{workflow.parameters.environment}} to chart version {{steps.get-initial-chart-version.outputs.result}}'
- - name: increment-chart-minor
templateRef:
name: cwft-helm
Expand All @@ -121,7 +89,7 @@ spec:
arguments:
artifacts:
- name: repo-source
from: '{{steps.set-environment-version.outputs.artifacts.repo-source}}'
from: '{{steps.set-chart-versions.outputs.artifacts.repo-source}}'
parameters:
- name: appName
value: '{{workflow.parameters.appName}}'
Expand Down Expand Up @@ -164,3 +132,81 @@ spec:
# gitlab skip ci rule: https://devops.stackexchange.com/questions/6809/is-there-a-ci-skip-option-in-gitlab-ci
# in case, the rule is disbaled or don't work this step will create a circular trigger of builds and bumps of version.
value: "[skip ci] [CI SKIP] setting {{workflow.parameters.appName}} {{workflow.parameters.environment}} to chart version {{steps.get-published-chart-version.outputs.result}}\n\nskip-checks:true"

- - name: set-app-version-and-bump-macro-chartz
templateRef:
name: cwft-helm
template: set-app-version-and-bump-macro-chart
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.set-chart-versions.outputs.artifacts.repo-source}}'
parameters:
- name: appName
value: '{{workflow.parameters.appName}}'
- name: chartDir
value: 'charts/kubefirst'
- name: nextAppChartVersion
value: '{{steps.get-initial-chart-version.outputs.result}}'

- - name: helm-dependency-update
templateRef:
name: cwft-helm
template: dependency-update
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.set-app-version-and-bump-macro-chartz.outputs.artifacts.repo-source}}'
parameters:
- name: chartDir
value: 'charts/kubefirst'

- - name: publish-macro-helm-chart
templateRef:
name: cwft-helm
template: publish-chart
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.helm-dependency-update.outputs.artifacts.repo-source}}'
parameters:
- name: appName
value: charts
- name: chartDir
value: 'charts/kubefirst'

- - name: get-current-macro-chart-version
templateRef:
name: cwft-helm
template: get-macro-chart-version
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.set-app-version-and-bump-macro-chartz.outputs.artifacts.repo-source}}'
parameters:
- name: chartDir
value: "charts/kubefirst"

- - name: pull-commit-push-tag-charts
templateRef:
name: cwft-git
template: pull-commit-push-tag
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.set-app-version-and-bump-macro-chartz.outputs.artifacts.repo-source}}'
parameters:
- name: commitMessage
value: 'tagged {{workflow.parameters.appName}} in charts kubefirst-v{{steps.get-current-macro-chart-version.outputs.result}}'
- name: gitUrlNoProtocol
value: '{{workflow.parameters.gitUrlNoProtocol}}'
- name: repoName
value: 'charts'
- name: tag
value: 'kubefirst-v{{steps.get-current-macro-chart-version.outputs.result}}'

39 changes: 39 additions & 0 deletions .argo/trigger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
namespace: argo
spec:
entrypoint: main
serviceAccountName: argo-server
templates:
- name: main
steps:
- - name: checkout
templateRef:
name: cwft-git
template: checkout-with-gitops
clusterScope: true
arguments:
parameters:
- name: appName
value: '{{workflow.parameters.appName}}'
- name: branch
value: '{{workflow.parameters.branch}}'
- name: gitUrlNoProtocol
value: '{{workflow.parameters.gitUrlNoProtocol}}'
- - name: pull-commit-empty-push
templateRef:
name: cwft-git
template: pull-commit-empty-push
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.checkout.outputs.artifacts.repo-source}}'
parameters:
- name: commitMessage
value: 'chore: triggered an empty commit against main branch'
- name: gitUrlNoProtocol
value: '{{workflow.parameters.gitUrlNoProtocol}}'
- name: repoName
value: '{{workflow.parameters.appName}}'

0 comments on commit f1d646a

Please sign in to comment.