Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLVSCODE-870 Fix silent failure of deployment to OpenVSX #628

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/actions/ovsx-publish/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const {
OPENVSX_TOKEN
} = process.env;

console.log(`Publishing ${ARTIFACT_FILE} to OpenVSX`);

(async () => {
/**
* @type ovsx.PublishOptions
Expand All @@ -29,10 +31,13 @@ const {
extensionFile: ARTIFACT_FILE,
pat: OPENVSX_TOKEN
};
await ovsx.publish(options);

const [ publicationResult ] = await ovsx.publish(options);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what caused the silent failure: ovsx.publish returns an array of PromiseSettledResult instead of failing 🤦🏻

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm looking at the correct thing, publish() returns a single Promise<PromiseSettledResult<void>[]>. With the await, we will get the array of settled/unsettled promises.

So I am thinking that we should consider the full array (not only the first element), and check if any of them have been rejected in the if below. 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory, yes; and when I run the script, the array contains only a single result. It could contain several items if we were publishing several packages at once.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, that makes sense!

if (publicationResult.status === 'rejected') {
throw new Error(`Impossible to publish ${ARTIFACT_FILE} to OpenVSX`, { cause: publicationResult.reason });
}
})()
.then(() => {
console.log(`Published ${ARTIFACT_FILE} to OpenVSX`);
process.exit(0);
})
.catch(e => {
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ jobs:
ARTIFACTORY_URL: https://repox.jfrog.io/artifactory
steps:
- name: Checkout custom actions
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
clean: false
- name: Use Node 18
uses: actions/setup-node@v3
- name: Use Node 20
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
- name: Get vault secrets
id: secrets
uses: SonarSource/vault-action-wrapper@dc8fe04652687f7278f3ecd27905967836bab0eb # tag=2.7.4-1
uses: SonarSource/vault-action-wrapper@3.0.1
with:
secrets: |
development/artifactory/token/{REPO_OWNER_NAME_DASH}-private-reader access_token | ARTIFACTORY_ACCESS_TOKEN;
Expand Down Expand Up @@ -106,14 +106,14 @@ jobs:
ARTIFACTORY_URL: https://repox.jfrog.io/artifactory
steps:
- name: Checkout custom actions
uses: actions/checkout@v3
- name: Use Node 18
uses: actions/setup-node@v3
uses: actions/checkout@v4
- name: Use Node 20
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'
- name: Get vault secrets
id: secrets
uses: SonarSource/vault-action-wrapper@dc8fe04652687f7278f3ecd27905967836bab0eb # tag=2.7.4-1
uses: SonarSource/vault-action-wrapper@3.0.1
with:
secrets: |
development/artifactory/token/{REPO_OWNER_NAME_DASH}-private-reader access_token | ARTIFACTORY_ACCESS_TOKEN;
Expand Down
Loading