You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ ./services promote --from https://github.com/organisation/first-environment.git --to https://github.com/organisation/second-environment.git --service service-a --commit-name <User to commit as> --commit-email <Email to commit as>
22
22
```
23
23
24
-
If the `commit-name` and `commit-email` are not provided, it will attempt to find them in `~/.gitconfig`, otherwise it will fail.
25
-
26
-
27
24
This will _copy_ all files under `/services/service-a/base/config/*` in `first-environment` to `second-environment`, commit and push, and open a PR for the change.
28
25
29
26
@@ -87,3 +84,13 @@ See the [tekton-example](./tekton-example/README.md) directory for more on using
87
84
## Release process
88
85
89
86
When a new tag is pushed with the `v` prefix, a GitHub release will be created with binaries produced for 64-bit Linux, and Mac automatically.
87
+
88
+
## Experimental plugin section
89
+
90
+
Inside of the `plugin` folder you'll see documentation and other files related to using the `services` binary as a plugin to `oc`. This has been tested with the following version on OpenShift 4.3:
Copy file name to clipboardExpand all lines: automerge-example/README.md
+1-8Lines changed: 1 addition & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,13 +18,6 @@ This example is for more advanced users. Start with the [tekton-example](../tekt
18
18
19
19
Our samples currently work with GitHub. They use the `hub` CLI to create a merge commit that when pushed, will merge the associated Pull Request. See [here](https://hub.github.com/hub-merge.1.html) for more details.
20
20
21
-
## gitconfig
22
-
23
-
Since we are creating git commits within the Tekton tasks, we need to know the username and email address to associate with them, as in our ['tekton-example'](../tekton-example/README.md). So, edit `gitconfig` and
@@ -86,7 +79,7 @@ Set up your Service Account and Secret as per the guide above. In this case you
86
79
- A ServiceAccount configured for use by Tekton.
87
80
- A Tekton-compatible Secret patched onto that that ServiceAccount containing your GitHub token.
88
81
89
-
This secret is used in two related ways. We check the source repository out using a Tekton Git PipelineResource. This sets up `~/.gitconfig` with the credentials needed for `git push` to work. It gets these credentials from the `accessToken` field of the relevant secret patched onto the ServiceAccount running the Tekton Task. We then extract the same field and export it into the `GITHUB_TOKEN` environment variable to make `hub merge` work. Instructions for creating this secret are in the Getting Started document linked above. You should have resources of the form,
82
+
This secret is used in two related ways. We check the source repository out using a Tekton Git PipelineResource. This sets up Git with the credentials needed for `git push` to work. It gets these credentials from the `accessToken` field of the relevant secret patched onto the ServiceAccount running the Tekton Task. We then extract the same field and export it into the `GITHUB_TOKEN` environment variable to make `hub merge` work. Instructions for creating this secret are in the Getting Started document linked above. You should have resources of the form,
Copy file name to clipboardExpand all lines: automerge-example/standalone/templates/automerge-task.yaml
+5-14Lines changed: 5 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -4,19 +4,15 @@ metadata:
4
4
name: automerge-task
5
5
spec:
6
6
params:
7
-
- name: github-config
7
+
- name: commit-name
8
8
type: string
9
-
description: configmap name of the gitconfig file that has user name, user e-mail. The key name is gitconfig. It can be created by "kubectl create configmap <configmap name> --from-file=gitconfig"
9
+
description: GitHub name to author the commit with
10
+
- name: commit-email
11
+
type: string
12
+
description: GitHub email to author the commit with
10
13
- name: github-secret
11
14
type: string
12
15
description: Name of the secret containing an access token for Github. Expects Tekton format, 'username' and 'password' keys.
Copy file name to clipboardExpand all lines: automerge-example/webhooks/templates/automerge-task.yaml
+3-17Lines changed: 3 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,7 @@ metadata:
4
4
name: automerge-task
5
5
spec:
6
6
params:
7
-
- name: github-config
8
-
type: string
9
-
description: configmap name of the gitconfig file that has user name, user e-mail. The key name is gitconfig. It can be created by "kubectl create configmap <configmap name> --from-file=gitconfig"
10
-
- name: github-secret
7
+
- name: github-secret
11
8
type: string
12
9
description: Name of the secret containing an access token for Github. Expects Tekton format, 'username' and 'password' keys.
13
10
- name: event-type
@@ -19,13 +16,6 @@ spec:
19
16
- name: pull-request-url
20
17
type: string
21
18
description: The URL of the pull request, where applicable
22
-
volumes:
23
-
- name: gitconfig
24
-
configMap:
25
-
name: $(params.github-config)
26
-
items:
27
-
- key: gitconfig
28
-
path: gitconfig
29
19
inputs:
30
20
resources:
31
21
- name: git-source
@@ -38,9 +28,6 @@ spec:
38
28
kubectl apply -k git-source/env --dry-run=client
39
29
- name: merge-pr
40
30
image: YOUR_DOCKER_HUB_ID/hub-test
41
-
volumeMounts:
42
-
- name: gitconfig
43
-
mountPath: /root
44
31
script: |
45
32
#!/bin/bash -x
46
33
@@ -52,12 +39,11 @@ spec:
52
39
echo "do nothing"
53
40
fi
54
41
elif [ $(params.event-type) = "pull_request" ]; then
55
-
56
-
cat /root/gitconfig >> $HOME/.gitconfig
57
42
# GHE requires some extra config
58
43
# Replace `YOUR_GHE` with your GitHub Enterprise domain e.g. `github.ibm.com`
This folder contains an example script that will compile the services binary and name it in such a way that it can be used as a plugin to `oc` - using `oc services promote ...` for example.
2
+
3
+
A Dockerfile is also provided that will pull in `oc` and copy the built plugin binary into that image. You could then push that image to your own testing place on Dockerhub for use later - be it as a standalone container or as part of a Tekton Task.
4
+
5
+
Build it with the following command from the main `services` folder:
This will store your GitHub username and email address in key-value pairs that can be used in the PipelineRun.
57
49
58
50
## Execute Pipeline
59
51
60
52
The PipelineRun you will create is designed to build your microservice from its development repository and then promote the new configuration to a GitOps repository (representing a different environment, for example development, staging, test or production).
Optionally, you can run a subsequent promote from one GitOps repository to another (e.g staging to prod) after merging the pull request on your first GitOps repository. For this you will need a third repository, and for this you can fork: https://github.com/rhd-gitops-example/gitops-example-staging
73
68
74
69
- To do this second promote, you will need to create a TaskRun that executes a task promoting from a testing repository to a production repository
75
-
- To create the TaskRun, use:
70
+
- To create the TaskRun (again this uses a service called `promote-demo`), use:
0 commit comments