Skip to content

Commit

Permalink
v3 new release (#192)
Browse files Browse the repository at this point in the history
* Make pulling of images switchable (#178)

* Make namespace annotation switchable (#177)

* Bump tmpl from 1.0.4 to 1.0.5 (#152)

Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/daaku/nodejs-tmpl/releases)
- [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5)

---
updated-dependencies:
- dependency-name: tmpl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ansi-regex from 5.0.0 to 5.0.1 (#166)

Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](chalk/ansi-regex@v5.0.0...v5.0.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump minimist from 1.2.5 to 1.2.6 (#175)

Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add directory functionality (#181)

* Modifying README to include instructions/examples for directory functionality (#183)

* Added some tests, not sure what else to try but gonna think of more examples

* forgot some files

* reverted package-lock.json

* Added empty dir test

* Cleaned up some extra spaces

* Add node modules and compiled JavaScript from main

* forgot to actually include functionality

* removed unnecessary files

* Update .gitignore

* Update .gitignore

* Update .gitignore

* thx david

* renamed searchFilesRec

* integrations test fix

* added examples to README

* added note about depth

* added additional note

* removed ticks

* changed version string

Co-authored-by: Jaiveer Katariya <jaiveerkatariya@Jaiveers-MacBook-Pro.local>
Co-authored-by: Oliver King <oking3@uncc.edu>

* Remove kubectl version example (#188)

* prefix for annotations (#191)

* Add node modules and compiled JavaScript from main

Co-authored-by: Jan Röhrich <roehrijn@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jaiveer Katariya <35347859+jaiveerk@users.noreply.github.com>
Co-authored-by: Jaiveer Katariya <jaiveerkatariya@Jaiveers-MacBook-Pro.local>
Co-authored-by: Oliver King <oking3@uncc.edu>
Co-authored-by: David Gamero <david340804@gmail.com>
  • Loading branch information
7 people authored Jun 8, 2022
1 parent e3c97bf commit 17f5181
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 17 deletions.
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 }}"
Expand All @@ -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
Expand All @@ -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 }}"
Expand All @@ -149,14 +148,15 @@ 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
```
### 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 }}"
Expand All @@ -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
Expand All @@ -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 }} "
Expand All @@ -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
Expand All @@ -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 }}"
Expand All @@ -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 }}"
Expand All @@ -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
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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: |
Expand Down
13 changes: 11 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) {
Expand Down
18 changes: 18 additions & 0 deletions src/utilities/workflowAnnotationUtils.test.ts
Original file line number Diff line number Diff line change
@@ -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);
});
});
});
12 changes: 11 additions & 1 deletion src/utilities/workflowAnnotationUtils.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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(
Expand Down

0 comments on commit 17f5181

Please sign in to comment.