Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add intital ci content #164

Merged
merged 1 commit into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .argo/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
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: get-initial-chart-version
templateRef:
name: cwft-helm
template: get-chart-version
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.checkout.outputs.artifacts.repo-source}}'
parameters:
- name: appName
value: '{{workflow.parameters.appName}}'
- name: chartDir
value: 'charts/{{workflow.parameters.appName}}'
- - 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}}-rc.{{workflow.parameters.shortSha}}'
- name: environment
value: '{{workflow.parameters.environment}}'
- - name: commit
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}}-rc.{{workflow.parameters.shortSha}}'
84 changes: 84 additions & 0 deletions .argo/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
namespace: argo
spec:
entrypoint: main
serviceAccountName: argo-server
templates:
- name: main
steps:
- - name: publish-container
templateRef:
name: cwft-kaniko
template: build-push
clusterScope: true
arguments:
parameters:
- name: appName
value: '{{workflow.parameters.appName}}'
- name: branch
value: '{{workflow.parameters.branch}}'
- name: containerRegistryURL
value: '{{workflow.parameters.containerRegistryURL}}'
- name: gitUrlNoProtocol
value: '{{workflow.parameters.gitUrlNoProtocol}}'
- - 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: get-initial-chart-version
templateRef:
name: cwft-helm
template: get-chart-version
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.checkout.outputs.artifacts.repo-source}}'
parameters:
- name: appName
value: '{{workflow.parameters.appName}}'
- name: chartDir
value: 'charts/{{workflow.parameters.appName}}'
- - name: set-chart-versions
templateRef:
name: cwft-helm
template: set-chart-versions
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.checkout.outputs.artifacts.repo-source}}'
parameters:
- name: appName
value: '{{workflow.parameters.appName}}'
- name: chartDir
value: 'charts/{{workflow.parameters.appName}}'
- name: chartVersion
value: '{{steps.get-initial-chart-version.outputs.result}}-rc.{{workflow.parameters.shortSha}}'
- name: shortSha
value: '{{workflow.parameters.shortSha}}'
- - name: publish-helm-chart
templateRef:
name: cwft-helm
template: publish-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/{{workflow.parameters.appName}}'
150 changes: 150 additions & 0 deletions .argo/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
apiVersion: argoproj.io/v1alpha1
kind: Workflow
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: get-initial-chart-version
templateRef:
name: cwft-helm
template: get-chart-version
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.checkout.outputs.artifacts.repo-source}}'
parameters:
- name: appName
value: '{{workflow.parameters.appName}}'
- name: chartDir
value: 'charts/{{workflow.parameters.appName}}'
- - name: set-chart-versions
templateRef:
name: cwft-helm
template: set-chart-versions
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.checkout.outputs.artifacts.repo-source}}'
parameters:
- name: appName
value: '{{workflow.parameters.appName}}'
- name: chartDir
value: 'charts/{{workflow.parameters.appName}}'
- name: chartVersion
value: '{{steps.get-initial-chart-version.outputs.result}}'
- name: shortSha
value: '{{workflow.parameters.shortSha}}'
- - name: publish-helm-chart
templateRef:
name: cwft-helm
template: publish-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/{{workflow.parameters.appName}}'
- - 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
template: increment-chart-minor
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.set-environment-version.outputs.artifacts.repo-source}}'
parameters:
- name: appName
value: '{{workflow.parameters.appName}}'
- name: chartDir
value: 'charts/{{workflow.parameters.appName}}'
- name: chartVersion
value: '{{steps.get-initial-chart-version.outputs.result}}'
- - name: get-published-chart-version
templateRef:
name: cwft-helm
template: get-chart-version
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.increment-chart-minor.outputs.artifacts.repo-source}}'
parameters:
- name: appName
value: '{{workflow.parameters.appName}}'
- name: chartDir
value: 'charts/{{workflow.parameters.appName}}'
- - name: commit-chart-increment
templateRef:
name: cwft-git
template: pull-commit-push
clusterScope: true
arguments:
artifacts:
- name: repo-source
from: '{{steps.increment-chart-minor.outputs.artifacts.repo-source}}'
parameters:
- name: repoName
value: '{{workflow.parameters.appName}}'
- name: gitUrlNoProtocol
value: '{{workflow.parameters.gitUrlNoProtocol}}'
- name: commitMessage
# Please, be careful updating this message, it must comply with:
# github skip ci rule: https://github.blog/changelog/2021-02-08-github-actions-skip-pull-request-and-push-workflows-with-skip-ci/
# github skip ci rule: https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs
# 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"
Loading