mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-21 18:59:27 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 17f5181337 |
@@ -42,7 +42,7 @@ Following are the key capabilities of this action:
|
||||
</tr>
|
||||
<tr>
|
||||
<td>manifests </br></br>(Required)</td>
|
||||
<td>Path to the manifest files to be used for deployment</td>
|
||||
<td>Path to the manifest files to be used for deployment. These can also be directories containing manifest files, in which case, all manifest files in the referenced directory at every depth will be deployed. Files not ending in .yml or .yaml will be ignored.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>namespace </br></br>(Optional)
|
||||
@@ -105,23 +105,21 @@ Following are the key capabilities of this action:
|
||||
### Basic deployment (without any deployment strategy)
|
||||
|
||||
```yaml
|
||||
- uses: Azure/k8s-deploy@v1.4
|
||||
- uses: Azure/k8s-deploy@v3.1
|
||||
with:
|
||||
namespace: "myapp"
|
||||
manifests: |
|
||||
deployment.yaml
|
||||
service.yaml
|
||||
dir/manifestsDirectory
|
||||
images: "contoso.azurecr.io/myapp:${{ event.run_id }}"
|
||||
imagepullsecrets: |
|
||||
image-pull-secret1
|
||||
image-pull-secret2
|
||||
kubectl-version: "latest"
|
||||
```
|
||||
|
||||
### Canary deployment without service mesh
|
||||
|
||||
```yaml
|
||||
- uses: Azure/k8s-deploy@v1.4
|
||||
- uses: Azure/k8s-deploy@v3.1
|
||||
with:
|
||||
namespace: "myapp"
|
||||
images: "contoso.azurecr.io/myapp:${{ event.run_id }}"
|
||||
@@ -131,6 +129,7 @@ Following are the key capabilities of this action:
|
||||
manifests: |
|
||||
deployment.yaml
|
||||
service.yaml
|
||||
dir/manifestsDirectory
|
||||
strategy: canary
|
||||
action: deploy
|
||||
percentage: 20
|
||||
@@ -139,7 +138,7 @@ Following are the key capabilities of this action:
|
||||
To promote/reject the canary created by the above snippet, the following YAML snippet could be used:
|
||||
|
||||
```yaml
|
||||
- uses: Azure/k8s-deploy@v1.4
|
||||
- uses: Azure/k8s-deploy@v3.1
|
||||
with:
|
||||
namespace: "myapp"
|
||||
images: "contoso.azurecr.io/myapp:${{ event.run_id }}"
|
||||
@@ -149,6 +148,7 @@ To promote/reject the canary created by the above snippet, the following YAML sn
|
||||
manifests: |
|
||||
deployment.yaml
|
||||
service.yaml
|
||||
dir/manifestsDirectory
|
||||
strategy: canary
|
||||
action: promote # substitute reject if you want to reject
|
||||
```
|
||||
@@ -156,7 +156,7 @@ To promote/reject the canary created by the above snippet, the following YAML sn
|
||||
### Canary deployment based on Service Mesh Interface
|
||||
|
||||
```yaml
|
||||
- uses: Azure/k8s-deploy@v1.4
|
||||
- uses: Azure/k8s-deploy@v3.1
|
||||
with:
|
||||
namespace: "myapp"
|
||||
images: "contoso.azurecr.io/myapp:${{ event.run_id }}"
|
||||
@@ -166,6 +166,7 @@ To promote/reject the canary created by the above snippet, the following YAML sn
|
||||
manifests: |
|
||||
deployment.yaml
|
||||
service.yaml
|
||||
dir/manifestsDirectory
|
||||
strategy: canary
|
||||
action: deploy
|
||||
traffic-split-method: smi
|
||||
@@ -176,7 +177,7 @@ To promote/reject the canary created by the above snippet, the following YAML sn
|
||||
To promote/reject the canary created by the above snippet, the following YAML snippet could be used:
|
||||
|
||||
```yaml
|
||||
- uses: Azure/k8s-deploy@v1.4
|
||||
- uses: Azure/k8s-deploy@v3.1
|
||||
with:
|
||||
namespace: "myapp"
|
||||
images: "contoso.azurecr.io/myapp:${{ event.run_id }} "
|
||||
@@ -186,6 +187,7 @@ To promote/reject the canary created by the above snippet, the following YAML sn
|
||||
manifests: |
|
||||
deployment.yaml
|
||||
service.yaml
|
||||
dir/manifestsDirectory
|
||||
strategy: canary
|
||||
traffic-split-method: smi
|
||||
action: reject # substitute reject if you want to reject
|
||||
@@ -194,7 +196,7 @@ To promote/reject the canary created by the above snippet, the following YAML sn
|
||||
### Blue-Green deployment with different route methods
|
||||
|
||||
```yaml
|
||||
- uses: Azure/k8s-deploy@v1.4
|
||||
- uses: Azure/k8s-deploy@v3.1
|
||||
with:
|
||||
namespace: "myapp"
|
||||
images: "contoso.azurecr.io/myapp:${{ event.run_id }}"
|
||||
@@ -214,7 +216,7 @@ To promote/reject the canary created by the above snippet, the following YAML sn
|
||||
To promote/reject the green workload created by the above snippet, the following YAML snippet could be used:
|
||||
|
||||
```yaml
|
||||
- uses: Azure/k8s-deploy@v1.4
|
||||
- uses: Azure/k8s-deploy@v3.1
|
||||
with:
|
||||
namespace: "myapp"
|
||||
images: "contoso.azurecr.io/myapp:${{ event.run_id }}"
|
||||
@@ -224,7 +226,7 @@ To promote/reject the green workload created by the above snippet, the following
|
||||
manifests: |
|
||||
deployment.yaml
|
||||
service.yaml
|
||||
ingress-yml
|
||||
ingress.yml
|
||||
strategy: blue-green
|
||||
route-method: ingress # should be the same as the value when action was deploy
|
||||
action: promote # substitute reject if you want to reject
|
||||
@@ -271,7 +273,7 @@ jobs:
|
||||
container-registry-password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
secret-name: demo-k8s-secret
|
||||
|
||||
- uses: Azure/k8s-deploy@v1.4
|
||||
- uses: Azure/k8s-deploy@v3.1
|
||||
with:
|
||||
action: deploy
|
||||
manifests: |
|
||||
@@ -317,7 +319,7 @@ jobs:
|
||||
container-registry-password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
secret-name: demo-k8s-secret
|
||||
|
||||
- uses: Azure/k8s-deploy@v1.4
|
||||
- uses: Azure/k8s-deploy@v3.1
|
||||
with:
|
||||
action: deploy
|
||||
manifests: |
|
||||
|
||||
+11
-2
@@ -20979,7 +20979,15 @@ exports.getTrafficSplitAPIVersion = getTrafficSplitAPIVersion;
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getWorkflowAnnotationKeyLabel = exports.getWorkflowAnnotations = void 0;
|
||||
exports.getWorkflowAnnotationKeyLabel = exports.getWorkflowAnnotations = exports.prefixObjectKeys = void 0;
|
||||
const ANNOTATION_PREFIX = "actions.github.com/";
|
||||
function prefixObjectKeys(obj, prefix) {
|
||||
return Object.keys(obj).reduce((newObj, key) => {
|
||||
newObj[prefix + key] = obj[key];
|
||||
return newObj;
|
||||
}, {});
|
||||
}
|
||||
exports.prefixObjectKeys = prefixObjectKeys;
|
||||
function getWorkflowAnnotations(lastSuccessRunSha, workflowFilePath, deploymentConfig) {
|
||||
const annotationObject = {
|
||||
run: process.env.GITHUB_RUN_ID,
|
||||
@@ -20998,7 +21006,8 @@ function getWorkflowAnnotations(lastSuccessRunSha, workflowFilePath, deploymentC
|
||||
helmChartPaths: deploymentConfig.helmChartFilePaths,
|
||||
provider: "GitHub",
|
||||
};
|
||||
return JSON.stringify(annotationObject);
|
||||
const prefixedAnnotationObject = prefixObjectKeys(annotationObject, ANNOTATION_PREFIX);
|
||||
return JSON.stringify(prefixedAnnotationObject);
|
||||
}
|
||||
exports.getWorkflowAnnotations = getWorkflowAnnotations;
|
||||
function getWorkflowAnnotationKeyLabel(workflowFilePath) {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { prefixObjectKeys } from "../utilities/workflowAnnotationUtils";
|
||||
|
||||
describe("WorkflowAnnotationUtils", () => {
|
||||
describe("prefixObjectKeys", () => {
|
||||
it("should prefix an object with a given prefix", () => {
|
||||
const obj = {
|
||||
foo: "bar",
|
||||
baz: "qux",
|
||||
};
|
||||
const prefix = "prefix.";
|
||||
const expected = {
|
||||
"prefix.foo": "bar",
|
||||
"prefix.baz": "qux",
|
||||
};
|
||||
expect(prefixObjectKeys(obj, prefix)).toEqual(expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,14 @@
|
||||
import { DeploymentConfig } from "../types/deploymentConfig";
|
||||
|
||||
const ANNOTATION_PREFIX = "actions.github.com/";
|
||||
|
||||
export function prefixObjectKeys(obj: any, prefix: string): any {
|
||||
return Object.keys(obj).reduce((newObj, key) => {
|
||||
newObj[prefix + key] = obj[key];
|
||||
return newObj;
|
||||
}, {});
|
||||
}
|
||||
|
||||
export function getWorkflowAnnotations(
|
||||
lastSuccessRunSha: string,
|
||||
workflowFilePath: string,
|
||||
@@ -22,7 +31,8 @@ export function getWorkflowAnnotations(
|
||||
helmChartPaths: deploymentConfig.helmChartFilePaths,
|
||||
provider: "GitHub",
|
||||
};
|
||||
return JSON.stringify(annotationObject);
|
||||
const prefixedAnnotationObject = prefixObjectKeys(annotationObject, ANNOTATION_PREFIX);
|
||||
return JSON.stringify(prefixedAnnotationObject);
|
||||
}
|
||||
|
||||
export function getWorkflowAnnotationKeyLabel(
|
||||
|
||||
Reference in New Issue
Block a user