Skip to content

Commit

Permalink
v4 new release (#268)
Browse files Browse the repository at this point in the history
* Add missing API switch for GHES (#200)

* Vidya reddy/prettier code (#203)

* switch none deployment strategy to basic (#204)

* switch none deployment strategy to basic

* update readme

* update deployment strategy fallthrough logic

* comment fixed

* add disclaimer for basic strategy only supporting deploy action

* Hari/beautify logs (#206)

* Logging changes for deploy

* Logging Changes with group

* format check changes

* Add ncc build to build script (#208)

Co-authored-by: Vidya Reddy <[email protected]>

* Logging Changes for Promote, Reject actions (#207)

* add clean function (#211)

* Added Traffic split annotations (#215)

* Added Traffic split annotations

* traffic split - blueGreen deployment

* traffic split - canary deployment

* Traffic split annotations - canary deployment

* updated Readme and action.yml

* Traffic split - canary deployment

* clean code

* Clean code

* Clean code

* Create annotation object

* Updated Readme and action.yml

* Spelling correction

Co-authored-by: Vidya Reddy <[email protected]>

* Swap annotation key to actions.github.com prefix (#216)

* Private Cluster functionality (#214)

* Fixed Blue/Green Strategy Ingress Route-Method Glitch  (#217)

* 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

* removed conflict on readme

* Added tests for bluegreen helper and resolved issue with ingress not being read correctly, still have to figure out why new services aren't showing up

* resolved services name issue

* looks functional, beginning refactor now

* refactored deploy methods for type error

* Removed refactor comments

* prettier

* implemented Oliver's feedback

* prettier

* added optional chaining operator

* removed refactor comment

Co-authored-by: Jaiveer Katariya <[email protected]>
Co-authored-by: Oliver King <[email protected]>
Co-authored-by: Jaiveer Katariya <[email protected]>

* Blue/Green Refactor (#229)

* fresh new branch

* Added coverage to gitignore

Signed-off-by: Jaiveer Katariya <[email protected]>

* reverted package-lock.json

Signed-off-by: Jaiveer Katariya <[email protected]>
Co-authored-by: Jaiveer Katariya <[email protected]>

* consider slashes while cleaning labels (#231)

fix prettier format check errors

* Fix README.md typo (#235)

* Bump @actions/core from 1.9.0 to 1.9.1 (#233)

Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.9.0 to 1.9.1.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

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

* Add permissions to README.md (#236)

* Add permissions to README.md

* remove space

* prettier

* remove extra changes

* fix spacing

* Add the bug report and feature request form (#237)

* Added the bug report and feature request form

* updated the url

* Fix issue form (#238)

* Fix description about baseline-and-canary-replicas (#241)

* Resolved issue with Canary deploy (#247)

* Added support message (#249)

* Deploy with Manifests from URLs (#251)

* added functionality, need to add/modify existing tests

* added tests

* updated readme

* prettier

* Fix private cluster kubectl exit code bug (#252)

* add private cluster exitCode check

* add proper output

* Added Integration Tests, Resolved Bugs With Annotations (#255)

* First commit - made manifests for test deployments, made manifests for i tests for other deployment strategies

* broke down blue/green

* added latest tags to test manifests for new tags

* remade tester

* ready to test bgi

* using all but first index of argv

* careless error with dicts

* added test to namespace

* realized i was silencing error

* indexing containers

* keyerror

* logging bc python errors are weird

* expected still string

* parsed args behaving weirdly

* test seems to be working now, applying changes to other YAMLs now

* blue/green ready to test

* oops

* oops

* Added additional labels to check

* hyphen

* Added our annotations

* lol

* added our labels to services too

* nonetype issue'

* nonetype issue'

* narrowing down parameter

* fixed annotations issue with promote

* adding debhug statement to figure out why services aren't getting annotations

* this should fix annotations issue for service

* not sure why this wasn't caught by intellisense

* should be fixed with removing comma but adding logs in case

* added linkerd install

* verification

* upgraded kubernetes version

* removing crds

* proxy option

* Added smi extension

* logging service

* smi svcs also getting labeled now

* matching ts type

* not sure where stable service is going

* remaining svc and deployment should match

* keeping stable service and ts object

* updated tests to reflect keeping ts object

* no green svc after promote

* duh

* lol

* canary work

* canary test ready

* logging for ing, filename for canary

* changed ingress svc key and returning svc files from smi canary deployment

* ts name

* forgot about baseline in first deploy

* *

* *

* smi canary should annotate, fixed cleanup

* typescript issue plus percentage

* forgot to type extra method

* removed cleaned up objects from annotate list

* logging because services aren't getting removed

* moving to try/catch strategy of annotation since deletion can fail silently/with warnings

* moved label to individual

* removing canary service check after promote

* pod ready for testing

* set weights to 1000

* selectors

* *

* percentage

* *

* typing

* mixed up pod and smi

* fixed tests

* prettier

* forgot to remove canary

* cleanup

* Added oliver's feedback + more cleanup

* ncc as dev dependency

* npx

* going back to global ncc install bc npm is being weird

* prettier

* removed unnecessary post step

* new commit with all changes (#258)

* Fixing Ubuntu Runner Issue (#259)

* changed ubuntu runner

* changed minikube action

* Version formatting

* nonedriveR

* update kube version

* installing conntrack'

* updated other actions

* update bg ingress api version

* prettify

* updated ingress backend for new api version

* Added path type

* prettify

* Add skip tls flag (#260)

* bump @actions/core (#262)

* fixed files to file (#265)

* Update README.md to v4 (#263)

* Add node modules and compiled JavaScript from main

Signed-off-by: Jaiveer Katariya <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: nv35 <[email protected]>
Co-authored-by: Vidya <[email protected]>
Co-authored-by: David Gamero <[email protected]>
Co-authored-by: Hariharan Subramanian <[email protected]>
Co-authored-by: Vidya Reddy <[email protected]>
Co-authored-by: Oliver King <[email protected]>
Co-authored-by: Marcus-Hines <[email protected]>
Co-authored-by: Jaiveer Katariya <[email protected]>
Co-authored-by: Jaiveer Katariya <[email protected]>
Co-authored-by: Jaiveer Katariya <[email protected]>
Co-authored-by: Alexander Bartsch <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kenta Nakase <[email protected]>
Co-authored-by: Asa Gayle <[email protected]>
  • Loading branch information
15 people authored Dec 6, 2022
1 parent d89c89b commit c7b3487
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 40 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Following are the key capabilities of this action:
### Basic deployment (without any deployment strategy)

```yaml
- uses: Azure/k8s-deploy@v3.1
- uses: Azure/k8s-deploy@v4
with:
namespace: 'myapp'
manifests: |
Expand Down Expand Up @@ -162,7 +162,7 @@ Following are the key capabilities of this action:
### Canary deployment without service mesh

```yaml
- uses: Azure/k8s-deploy@v3.1
- uses: Azure/k8s-deploy@v4
with:
namespace: 'myapp'
images: 'contoso.azurecr.io/myapp:${{ event.run_id }}'
Expand All @@ -181,7 +181,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@v3.1
- uses: Azure/k8s-deploy@v4
with:
namespace: 'myapp'
images: 'contoso.azurecr.io/myapp:${{ event.run_id }}'
Expand All @@ -199,7 +199,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@v3.1
- uses: Azure/k8s-deploy@v4
with:
namespace: 'myapp'
images: 'contoso.azurecr.io/myapp:${{ event.run_id }}'
Expand All @@ -220,7 +220,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@v3.1
- uses: Azure/k8s-deploy@v4
with:
namespace: 'myapp'
images: 'contoso.azurecr.io/myapp:${{ event.run_id }} '
Expand All @@ -239,7 +239,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@v3.1
- uses: Azure/k8s-deploy@v4
with:
namespace: 'myapp'
images: 'contoso.azurecr.io/myapp:${{ event.run_id }}'
Expand All @@ -259,7 +259,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@v3.1
- uses: Azure/k8s-deploy@v4
with:
namespace: 'myapp'
images: 'contoso.azurecr.io/myapp:${{ event.run_id }}'
Expand Down Expand Up @@ -316,7 +316,7 @@ jobs:
container-registry-password: ${{ secrets.REGISTRY_PASSWORD }}
secret-name: demo-k8s-secret
- uses: Azure/k8s-deploy@v3.1
- uses: Azure/k8s-deploy@v4
with:
action: deploy
manifests: |
Expand Down Expand Up @@ -362,7 +362,7 @@ jobs:
container-registry-password: ${{ secrets.REGISTRY_PASSWORD }}
secret-name: demo-k8s-secret
- uses: Azure/k8s-deploy@v3.1
- uses: Azure/k8s-deploy@v4
with:
action: deploy
manifests: |
Expand Down
59 changes: 37 additions & 22 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ const file_command_1 = __nccwpck_require__(8466);
const utils_1 = __nccwpck_require__(7369);
const os = __importStar(__nccwpck_require__(2037));
const path = __importStar(__nccwpck_require__(1017));
const uuid_1 = __nccwpck_require__(487);
const oidc_utils_1 = __nccwpck_require__(7557);
/**
* The code to exit an action
Expand Down Expand Up @@ -170,20 +169,9 @@ function exportVariable(name, val) {
process.env[name] = convertedVal;
const filePath = process.env['GITHUB_ENV'] || '';
if (filePath) {
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
// These should realistically never happen, but just in case someone finds a way to exploit uuid generation let's not allow keys or values that contain the delimiter.
if (name.includes(delimiter)) {
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
}
if (convertedVal.includes(delimiter)) {
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
}
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
file_command_1.issueCommand('ENV', commandValue);
}
else {
command_1.issueCommand('set-env', { name }, convertedVal);
return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));
}
command_1.issueCommand('set-env', { name }, convertedVal);
}
exports.exportVariable = exportVariable;
/**
Expand All @@ -201,7 +189,7 @@ exports.setSecret = setSecret;
function addPath(inputPath) {
const filePath = process.env['GITHUB_PATH'] || '';
if (filePath) {
file_command_1.issueCommand('PATH', inputPath);
file_command_1.issueFileCommand('PATH', inputPath);
}
else {
command_1.issueCommand('add-path', {}, inputPath);
Expand Down Expand Up @@ -241,7 +229,10 @@ function getMultilineInput(name, options) {
const inputs = getInput(name, options)
.split('\n')
.filter(x => x !== '');
return inputs;
if (options && options.trimWhitespace === false) {
return inputs;
}
return inputs.map(input => input.trim());
}
exports.getMultilineInput = getMultilineInput;
/**
Expand Down Expand Up @@ -274,8 +265,12 @@ exports.getBooleanInput = getBooleanInput;
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setOutput(name, value) {
const filePath = process.env['GITHUB_OUTPUT'] || '';
if (filePath) {
return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));
}
process.stdout.write(os.EOL);
command_1.issueCommand('set-output', { name }, value);
command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));
}
exports.setOutput = setOutput;
/**
Expand Down Expand Up @@ -404,7 +399,11 @@ exports.group = group;
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function saveState(name, value) {
command_1.issueCommand('save-state', { name }, value);
const filePath = process.env['GITHUB_STATE'] || '';
if (filePath) {
return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));
}
command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));
}
exports.saveState = saveState;
/**
Expand Down Expand Up @@ -470,13 +469,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.issueCommand = void 0;
exports.prepareKeyValueMessage = exports.issueFileCommand = void 0;
// We use any as a valid input type
/* eslint-disable @typescript-eslint/no-explicit-any */
const fs = __importStar(__nccwpck_require__(7147));
const os = __importStar(__nccwpck_require__(2037));
const uuid_1 = __nccwpck_require__(487);
const utils_1 = __nccwpck_require__(7369);
function issueCommand(command, message) {
function issueFileCommand(command, message) {
const filePath = process.env[`GITHUB_${command}`];
if (!filePath) {
throw new Error(`Unable to find environment variable for file command ${command}`);
Expand All @@ -488,7 +488,22 @@ function issueCommand(command, message) {
encoding: 'utf8'
});
}
exports.issueCommand = issueCommand;
exports.issueFileCommand = issueFileCommand;
function prepareKeyValueMessage(key, value) {
const delimiter = `ghadelimiter_${uuid_1.v4()}`;
const convertedValue = utils_1.toCommandValue(value);
// These should realistically never happen, but just in case someone finds a
// way to exploit uuid generation let's not allow keys or values that contain
// the delimiter.
if (key.includes(delimiter)) {
throw new Error(`Unexpected input: name should not contain the delimiter "${delimiter}"`);
}
if (convertedValue.includes(delimiter)) {
throw new Error(`Unexpected input: value should not contain the delimiter "${delimiter}"`);
}
return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;
}
exports.prepareKeyValueMessage = prepareKeyValueMessage;
//# sourceMappingURL=file-command.js.map

/***/ }),
Expand Down Expand Up @@ -22060,7 +22075,7 @@ function labelResources(files, kubectl, label) {
const labelResults = [];
for (const file of files) {
try {
const labelResult = yield kubectl.labelFiles(files, labels);
const labelResult = yield kubectl.labelFiles(file, labels);
labelResults.push(labelResult);
}
catch (e) {
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"format-check": "prettier --check ."
},
"dependencies": {
"@actions/core": "^1.9.1",
"@actions/core": "^1.10.0",
"@actions/exec": "^1.0.0",
"@actions/io": "^1.0.0",
"@actions/tool-cache": "1.1.2",
Expand Down
2 changes: 1 addition & 1 deletion src/strategyHelpers/deploymentHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ async function labelResources(
const labelResults = []
for (const file of files) {
try {
const labelResult = await kubectl.labelFiles(files, labels)
const labelResult = await kubectl.labelFiles(file, labels)
labelResults.push(labelResult)
} catch (e) {
core.warning(`failed to annotate resource: ${e}`)
Expand Down

0 comments on commit c7b3487

Please sign in to comment.