forked from argoproj/rollouts-demo
-
Notifications
You must be signed in to change notification settings - Fork 26
151 lines (121 loc) · 6.46 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Github-action-demo
on:
pull_request:
branches:
- master
types:
- closed
jobs:
build:
environment:
name: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & push the Docker image
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
run: |
export VERSION=$(cat service.yaml)
export CF_IMAGE=$DOCKERHUB_USERNAME/${{ github.event.repository.name }}:$VERSION
echo "CF_IMAGE=$CF_IMAGE" >> $GITHUB_ENV
docker build . --file Dockerfile --build-arg COLOR=$VERSION --tag $CF_IMAGE && docker push $CF_IMAGE
- name: report image
with:
# Codefresh token used to perform authentication with your account. It is recommended to store as a secret variable. !! Committing a plain text token is a security risk. We highly recommend using encrypted secrets. !!
# Documentation - https://docs.github.com/en/actions/security-guides/encrypted-secrets
CF_API_KEY: ${{secrets.CF3_API}}
# The name of the runtime that will perform the enrichment. All Integrations must configured on this runtime
CF_RUNTIME_NAME: 'codefresh'
# Image reported and enriched in Codefresh. Pass the [account-name]/[image-name]:[tag] built in your CI.
CF_IMAGE: ${{env.CF_IMAGE}}
# Select the Container registry integration where image is stored
CF_CONTAINER_REGISTRY_INTEGRATION: 'docker'
# Commit and Pull request data from this branch will be added to the image. Pass the Branch from the event payload used to trigger your action.
CF_GIT_BRANCH: ${{ github.event.pull_request.head.ref }}
# Select the Issue tracking integration to use to enrich the image
CF_ISSUE_TRACKING_INTEGRATION: 'jira'
# Jira prjoect ID, XX-1345
CF_JIRA_PROJECT_PREFIX: 'CR'
# Search for issue IDs matching this string to associate with your image. Pass a commit message or branch from the event payload used to trigger your action.
CF_JIRA_MESSAGE: ${{ github.event.pull_request.head.ref }}
uses: codefresh-io/codefresh-report-image@latest
# - name: report image
# with:
# Runtime to use for the enrichment.
# CF_RUNTIME_NAME: 'codefresh-hosted'
# API key for authentication to Codefresh. !! Committing a plain text token is a security risk. We highly recommend using encrypted secrets. !!
# Documentation - https://docs.github.com/en/actions/security-guides/encrypted-secrets
# CF_API_KEY: ${{secrets.CF2_API_KEY}}
# Image reported and enriched in Codefresh. Pass the [account-name]/[image-name]:[tag] built in your CI.
# CF_IMAGE: ${{env.CF_IMAGE}}
# Container registry integration where the image is stored.
# CF_CONTAINER_REGISTRY_INTEGRATION: 'docker'
# Git branch with the commit Pull Request data to add to the image. Pass the branch from the event payload used to trigger your action.
# CF_GIT_BRANCH: ${{ github.event.pull_request.head.ref }}
# GitHub authentication token. !! Committing a plain text token is a security risk. We highly recommend using encrypted secrets. !!
# Documentation - https://docs.github.com/en/actions/security-guides/encrypted-secrets
# CF_GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# Issue tracking integration to use to enrich the image.
# CF_JIRA_INTEGRATION: 'jira'
# Jira project prefix identifying the ticket number to use.
# CF_JIRA_PROJECT_PREFIX: 'CR'
# Search for issue IDs matching this string to associate with your image.
# CF_JIRA_MESSAGE: ${{ github.event.pull_request.head.ref }}
# uses: codefresh-io/codefresh-report-image@latest
# - name: report image
# with:
# Name of runtime to implement the enrichment
# CF_RUNTIME_NAME: 'codefresh-hosted'
# Codefresh API key !! Committing a plain text token is a security risk. We highly recommend using an encrypted secrets. !!
# Documentation - https://docs.github.com/en/actions/security-guides/encrypted-secrets
# CF_API_KEY: ${{secrets.CF_API_KEY}}
# Name of Container registry integration
# CF_CONTAINER_REGISTRY_INTEGRATION: 'docker'
# Name of Jira integration
#CF_JIRA_INTEGRATION: 'jira'
# Image path to enrich
#CF_IMAGE: ${{ env.CF_IMAGE }}
# CF_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:green
# GitHub Access token !! Committing a plain text token is a security risk. We highly recommend using an encrypted secrets. !!
# Documentation - https://docs.github.com/en/actions/security-guides/encrypted-secrets
# CF_GITHUB_TOKEN: ${{secrets.PAT}}
# Jira project filter
#CF_JIRA_PROJECT_PREFIX: 'CR'
# CF_JIRA_MESSAGE: 'test'
# CF_GIT_BRANCH: 'master'
# String starting with the issue ID to associate with image
# CF_JIRA_MESSAGE: "${{ github.event.pull_request.head.ref }}"
# CF_GIT_BRANCH: "${{ github.event.pull_request.head.ref }}"
# uses: codefresh-io/codefresh-report-image@latest
- name: Checkout csdp-salesdemo_applications
uses: actions/checkout@v3
with:
repository: idan-codefresh/canary-rollout # change to real repo
path: .
- name: Update application version
run: |
IMAGE=${{ env.CF_IMAGE }} yq -i '.spec.template.spec.containers.[0].image = strenv(IMAGE)' canary-rollout.yaml
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.PAT }}
commit-message: Update version
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: update-application-version
delete-branch: true
title: 'Update application version'
body: |
Update deployment version
- Updated new version for hello-world application
labels: |
automated pr
draft: false