Compare commits
23 Commits
Author | SHA1 | Date |
---|---|---|
|
29879c9c50 | |
|
f8ac9fdddd | |
|
83879f19b9 | |
|
3807dd4c7c | |
|
dcf0138dc6 | |
|
3a40496053 | |
|
bc3c31fde7 | |
|
a4e868e155 | |
|
9df84f7b03 | |
|
bd38964ec7 | |
|
45f4d187f9 | |
|
4f8ae8fd28 | |
|
b26d0fe557 | |
|
86fcb138e6 | |
|
dbb3458abb | |
|
7af4c38280 | |
|
a407622bea | |
|
9bd430f7c0 | |
|
797a8f926d | |
|
d3e079abc8 | |
|
f2c1806ecc | |
|
85d0539168 | |
|
721397fbe5 |
|
@ -1,16 +1,22 @@
|
|||
name: Build
|
||||
run-name: "Build: ${{ github.event_name != 'workflow_dispatch' && 'Automatic' || 'Release' }}"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
- '**'
|
||||
tags:
|
||||
- v*
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
pull_request:
|
||||
branches:
|
||||
- '**'
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
test-latest:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
@ -29,11 +35,11 @@ jobs:
|
|||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22.x"
|
||||
node-version: '22.x'
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.23.8"
|
||||
go-version: '1.23.8'
|
||||
|
||||
- run: npm install
|
||||
working-directory: vscode-extension
|
||||
|
@ -52,6 +58,12 @@ jobs:
|
|||
- run: xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm test
|
||||
working-directory: vscode-extension
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: failure()
|
||||
with:
|
||||
name: screenshots
|
||||
path: /tmp/test-resources/screenshots/
|
||||
|
||||
test-release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
@ -60,7 +72,7 @@ jobs:
|
|||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22.x"
|
||||
node-version: '22.x'
|
||||
|
||||
- run: npm install
|
||||
|
||||
|
@ -68,7 +80,14 @@ jobs:
|
|||
|
||||
- run: xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npm test
|
||||
|
||||
build:
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: failure()
|
||||
with:
|
||||
name: screenshots
|
||||
path: /tmp/test-resources/screenshots/
|
||||
|
||||
upload:
|
||||
if: github.event_name != 'workflow_dispatch'
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- test-latest
|
||||
|
@ -77,42 +96,33 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
os: [alpine, linux, win32, darwin]
|
||||
arch: [amd64, arm64]
|
||||
nodearch: [x64, arm64]
|
||||
include:
|
||||
- arch: amd64
|
||||
nodearch: x64
|
||||
- arch: arm64
|
||||
nodearch: arm64
|
||||
- os: win32
|
||||
nodeos: win32
|
||||
ext: .exe
|
||||
- os: darwin
|
||||
nodeos: darwin
|
||||
ext: ""
|
||||
ext: ''
|
||||
- os: linux
|
||||
nodeos: linux
|
||||
ext: ""
|
||||
ext: ''
|
||||
- os: alpine
|
||||
nodeos: linux
|
||||
ext: ""
|
||||
ext: ''
|
||||
|
||||
steps:
|
||||
- name: actions/checkout@v4 (docker/vscode-extension)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: vscode-extension
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22.x"
|
||||
node-version: '22.x'
|
||||
|
||||
- working-directory: vscode-extension
|
||||
run: |
|
||||
- run: |
|
||||
NODE_OS=${{ matrix.nodeos }} NODE_ARCH=${{ matrix.nodearch }} npm install
|
||||
|
||||
- name: Set variables
|
||||
id: set-variables
|
||||
working-directory: vscode-extension
|
||||
run: |
|
||||
VERSION=$(npm pkg get version | tr -d \")
|
||||
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
@ -120,44 +130,113 @@ jobs:
|
|||
SHA=$(git rev-parse --short HEAD)
|
||||
echo "SHA=$SHA" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build the extension (refs/heads)
|
||||
if: startsWith(github.ref, 'refs/heads')
|
||||
- name: Build the extension
|
||||
env:
|
||||
VERSION: ${{ steps.set-variables.outputs.VERSION }}
|
||||
SHA: ${{ steps.set-variables.outputs.SHA }}
|
||||
working-directory: vscode-extension
|
||||
run: |
|
||||
npm install -g @vscode/vsce
|
||||
vsce package --target ${{ matrix.os }}-${{ matrix.nodearch }} -o docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-$VERSION-$SHA.vsix
|
||||
|
||||
- name: actions/upload-artifact@v4 (refs/heads)
|
||||
if: startsWith(github.ref, 'refs/heads')
|
||||
uses: actions/upload-artifact@v4
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}-${{ steps.set-variables.outputs.SHA }}.vsix
|
||||
path: vscode-extension/docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}-${{ steps.set-variables.outputs.SHA }}.vsix
|
||||
path: docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}-${{ steps.set-variables.outputs.SHA }}.vsix
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Build the extension (refs/tags/v)
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
create-release:
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- test-latest
|
||||
- test-release
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22.x'
|
||||
|
||||
- name: Set variables
|
||||
id: set-variables
|
||||
run: |
|
||||
VERSION=$(npm pkg get version | tr -d \")
|
||||
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Generate release notes
|
||||
run: |
|
||||
node build/releaser.mjs generate-release-notes > release-notes.tmp
|
||||
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "current_date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8 https://github.com/softprops/action-gh-release/commit/c062e08bd532815e2082a85e87e3ef29c3e6d191
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
name: v${{ steps.set-variables.outputs.version }} - ${{ steps.date.outputs.current_date }}
|
||||
tag_name: v${{ steps.set-variables.outputs.version }}
|
||||
body_path: release-notes.tmp
|
||||
fail_on_unmatched_files: true
|
||||
|
||||
upload-release-binaries:
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- create-release
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [alpine, linux, win32, darwin]
|
||||
nodearch: [x64, arm64]
|
||||
include:
|
||||
- os: win32
|
||||
nodeos: win32
|
||||
ext: .exe
|
||||
- os: darwin
|
||||
nodeos: darwin
|
||||
ext: ''
|
||||
- os: linux
|
||||
nodeos: linux
|
||||
ext: ''
|
||||
- os: alpine
|
||||
nodeos: linux
|
||||
ext: ''
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22.x'
|
||||
|
||||
- run: |
|
||||
NODE_OS=${{ matrix.nodeos }} NODE_ARCH=${{ matrix.nodearch }} npm install
|
||||
|
||||
- name: Set variables
|
||||
id: set-variables
|
||||
run: |
|
||||
VERSION=$(npm pkg get version | tr -d \")
|
||||
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build the extension
|
||||
env:
|
||||
VERSION: ${{ steps.set-variables.outputs.VERSION }}
|
||||
working-directory: vscode-extension
|
||||
run: |
|
||||
npm install -g @vscode/vsce
|
||||
vsce package --target ${{ matrix.os }}-${{ matrix.nodearch }} -o docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-$VERSION.vsix
|
||||
|
||||
- name: actions/upload-artifact@v4 (refs/tags/v)
|
||||
uses: actions/upload-artifact@v4
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}.vsix
|
||||
path: vscode-extension/docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}.vsix
|
||||
path: docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}.vsix
|
||||
if-no-files-found: error
|
||||
|
||||
- uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8 https://github.com/softprops/action-gh-release/commit/c062e08bd532815e2082a85e87e3ef29c3e6d191
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
files: vscode-extension/docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}.vsix
|
||||
tag_name: v${{ steps.set-variables.outputs.version }}
|
||||
files: docker-vscode-extension-${{ matrix.os }}-${{ matrix.nodearch }}-${{ steps.set-variables.outputs.VERSION }}.vsix
|
||||
if-no-files-found: error
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
name: Prepare release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version_type:
|
||||
description: Version type
|
||||
required: true
|
||||
default: minor
|
||||
type: choice
|
||||
options:
|
||||
- patch
|
||||
- minor
|
||||
- major
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
prepare-release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22.x
|
||||
|
||||
- name: Update versions in package.json and package-lock.json
|
||||
id: version
|
||||
run: |
|
||||
npm version ${{ github.event.inputs.version_type }} --no-git-tag-version
|
||||
NEW_VERSION=$(npm pkg get version | tr -d \")
|
||||
echo "New version (${{ github.event.inputs.version_type }}): $NEW_VERSION"
|
||||
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Update changelog to version ${{ steps.version.outputs.new_version }}
|
||||
run: |
|
||||
node build/releaser.mjs update-changelog ${{ steps.version.outputs.new_version }}
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
|
||||
git config --local user.name "${{ github.actor }}"
|
||||
|
||||
- name: Create pull request
|
||||
# https://github.com/peter-evans/create-pull-request/releases/tag/v7.0.8
|
||||
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
base: main
|
||||
branch: bot/prepare-release-v${{ steps.version.outputs.new_version }}
|
||||
commit-message: |
|
||||
Prepare for the v${{ steps.version.outputs.new_version }} release
|
||||
|
||||
This commit was generated by a GitHub Action workflow. It was triggered
|
||||
by ${{ github.actor }}.
|
||||
signoff: true
|
||||
delete-branch: true
|
||||
title: 'Prepare for the v${{ steps.version.outputs.new_version }} release (triggered by ${{ github.actor }})'
|
||||
body: |
|
||||
This pull request was generated by `./github/workflows/prepare-release.yml`.
|
||||
|
||||
It modifies the following three files:
|
||||
- `CHANGELOG.md` (update the section header to ${{ steps.version.outputs.new_version }} with today's date in UTC and the links at the bottom)
|
||||
- `package.json` (update version number to ${{ steps.version.outputs.new_version }} )
|
||||
- `package-lock.json` (update version number to ${{ steps.version.outputs.new_version }})
|
||||
draft: false
|
||||
add-paths: |
|
||||
CHANGELOG.md
|
||||
package.json
|
||||
package-lock.json
|
||||
assignees: ${{ github.actor }}
|
||||
reviewers: ${{ github.actor }}
|
|
@ -10,8 +10,4 @@ bin
|
|||
.test-extensions
|
||||
syntaxes/
|
||||
misc/
|
||||
|
||||
.github/workflows/build.yml
|
||||
|
||||
|
||||
*/coverage
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"editor.formatOnSave": true,
|
||||
"[javascript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"[json]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"[typescriptreact]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
|
|
51
CHANGELOG.md
51
CHANGELOG.md
|
@ -2,6 +2,54 @@
|
|||
|
||||
All notable changes to the Docker DX extension will be documented in this file.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- Dockerfile
|
||||
- textDocument/inlayHint
|
||||
- show when an image was last pushed ([docker/docker-language-server#431](https://github.com/docker/docker-language-server/issues/431))
|
||||
- Compose
|
||||
- textDocument/completion
|
||||
- suggest image tags for images from Docker Hub ([docker/docker-language-server#375](https://github.com/docker/docker-language-server/issues/375))
|
||||
- textDocument/documentLink
|
||||
- support providing links for the `env_file` attribute of a service object ([docker/docker-language-server#436](https://github.com/docker/docker-language-server/issues/436))
|
||||
- support providing links for the `env_file` for included paths ([docker/docker-language-server#438](https://github.com/docker/docker-language-server/issues/438))
|
||||
- Bake
|
||||
- textDocument/completion
|
||||
- provide local file and folder name suggestions ([docker/docker-language-server#414](https://github.com/docker/docker-language-server/issues/414))
|
||||
- `context` attribute in a `target` block
|
||||
- `contexts` attribute in a `target` block
|
||||
- `dockerfile` attribute in a `target` block
|
||||
|
||||
### Fixed
|
||||
|
||||
- Dockerfile
|
||||
- textDocument/hover
|
||||
- ignore 4XX errors when hovering over images with a non-standard tag ([docker/docker-language-server#371](https://github.com/docker/docker-language-server/issues/371))
|
||||
- Compose
|
||||
- textDocument/completion
|
||||
- correct file system suggestions if an absolute path is used ([docker/docker-language-server#443](https://github.com/docker/docker-language-server/issues/443))
|
||||
- textDocument/documentLink
|
||||
- stop returning links for alias nodes in included paths ([docker/docker-language-server#439](https://github.com/docker/docker-language-server/issues/439))
|
||||
- Bake
|
||||
- textDocument/completion
|
||||
- check the type of the block before suggesting items ([docker/docker-language-server#422](https://github.com/docker/docker-language-server/issues/422))
|
||||
|
||||
## [0.15.0] - 2025-08-13
|
||||
|
||||
### Added
|
||||
|
||||
- added a language configuration for the `dockerbake` language to improve the editing experience ([#184](https://github.com/docker/vscode-extension/issues/184))
|
||||
- Compose
|
||||
- updated Compose schema to the latest version
|
||||
|
||||
### Fixed
|
||||
|
||||
- Bake
|
||||
- textDocument/hover
|
||||
- fix error when hovering inside a comment ([docker/docker-language-server#410](https://github.com/docker/docker-language-server/issues/410))
|
||||
|
||||
## [0.14.0] - 2025-08-06
|
||||
|
||||
### Added
|
||||
|
@ -455,7 +503,8 @@ All notable changes to the Docker DX extension will be documented in this file.
|
|||
- error reporting
|
||||
- Compose outline support
|
||||
|
||||
[Unreleased]: https://github.com/docker/vscode-extension/compare/v0.14.0...main
|
||||
[Unreleased]: https://github.com/docker/docker-language-server/compare/v0.15.0...main
|
||||
[0.15.0]: https://github.com/docker/docker-language-server/compare/v0.14.0...v0.15.0
|
||||
[0.14.0]: https://github.com/docker/vscode-extension/compare/v0.13.0...v0.14.0
|
||||
[0.13.0]: https://github.com/docker/vscode-extension/compare/v0.12.0...v0.13.0
|
||||
[0.12.0]: https://github.com/docker/vscode-extension/compare/v0.11.0...v0.12.0
|
||||
|
|
13
README.md
13
README.md
|
@ -88,6 +88,19 @@ To debug the VS Code extension, clone this repository and then run `npm install`
|
|||
|
||||
Run `npm test` to launch the UI tests.
|
||||
|
||||
### Releasing
|
||||
|
||||
Follow the following steps to create a new release of the Docker DX Visual Studio Code extension:
|
||||
|
||||
1. Run the "[prepare release](https://github.com/docker/vscode-extension/actions/workflows/prepare-release.yml)" workflow with the desired bump in semantic versioning. This workflow will update `CHANGELOG.md`, `package.json`, and `package-lock.json` and create a pull request with the three files.
|
||||
2. Review the generated [pull request](https://github.com/docker/vscode-extension/pulls).
|
||||
1. The pull request's description will describe the changes to the three files. Verify that the changes make sense.
|
||||
2. If the changes look good and the builds and checks have completed and passed, approve the pull request and merge it manually.
|
||||
3. Now that the pull request has been merged into the `main` branch, a build named "Build: Automatic" will be triggered. Wait for the automated build from the "[build](https://github.com/docker/vscode-extension/actions/workflows/build.yml)" workflow to complete.
|
||||
4. If the build has completed successfully, use the "Run workflow" button to manually trigger the "[build](https://github.com/docker/vscode-extension/actions/workflows/build.yml)" workflow.
|
||||
5. This manually triggered workflow will start a "Build: Release" which will run the tests, create the release, build the binaries, and attach the binaries to the release.
|
||||
6. When the workflow has completed, open the [releases](https://github.com/docker/vscode-extension/releases) page. It should have been automatically generated by the workflow and the resulting VSIX files should be attached to the release.
|
||||
|
||||
## Telemetry
|
||||
|
||||
The Docker DX extension collects telemetry. We collect this telemetry so that we can improve the extension by understanding usage patterns and catching crashes and errors for diagnostic purposes. Note that if you have already opted out of sending telemetry in Visual Studio Code then no telemetry will be sent.
|
||||
|
|
|
@ -77,7 +77,7 @@ async function downloadLanguageServerBinary() {
|
|||
const platform = getPlatform();
|
||||
const arch = getArch();
|
||||
const suffix = platform === 'windows' ? '.exe' : '';
|
||||
const version = '0.15.0';
|
||||
const version = '0.17.0';
|
||||
const binaryFile = `docker-language-server-${platform}-${arch}-v${version}${suffix}`;
|
||||
const targetFile = `docker-language-server-${platform}-${arch}${suffix}`;
|
||||
const url = `https://github.com/docker/docker-language-server/releases/download/v${version}/${binaryFile}`;
|
||||
|
|
|
@ -0,0 +1,170 @@
|
|||
import * as fs from 'fs';
|
||||
import * as readline from 'readline';
|
||||
|
||||
const changelogPath = 'CHANGELOG.md';
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
if (args.length < 1) {
|
||||
console.error(
|
||||
`Usage: node releaser.mjs <update-changelog|generate-release-notes> [args...]`,
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const command = args[0].toLowerCase();
|
||||
|
||||
if (command === 'update-changelog') {
|
||||
if (args.length < 2) {
|
||||
console.error(`Usage: node releaser.js update-changelog <version>`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const version = args[1];
|
||||
if (!/^\d+\.\d+\.\d+$/.test(version)) {
|
||||
console.error(`Error: version must be in format x.y.z (e.g., 1.2.3)`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
updateChangelog(changelogPath, changelogPath, version)
|
||||
.then(() =>
|
||||
console.log(`Successfully updated CHANGELOG.md with version ${version}`),
|
||||
)
|
||||
.catch((err) => {
|
||||
console.error(`Error: ${err.message}`);
|
||||
process.exit(1);
|
||||
});
|
||||
} else if (command === 'generate-release-notes') {
|
||||
generateReleaseNotes(changelogPath)
|
||||
.then((content) => console.log(content))
|
||||
.catch((err) => {
|
||||
console.error(`Error: ${err.message}`);
|
||||
process.exit(1);
|
||||
});
|
||||
} else {
|
||||
console.error(
|
||||
`Error: unknown command '${command}'. Use 'update-changelog' or 'generate-release-notes'`,
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
function readFileLines(filePath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const lines = [];
|
||||
const rl = readline.createInterface({
|
||||
input: fs.createReadStream(filePath),
|
||||
crlfDelay: Infinity,
|
||||
});
|
||||
|
||||
rl.on('line', (line) => lines.push(line));
|
||||
rl.on('close', () => resolve(lines));
|
||||
rl.on('error', reject);
|
||||
});
|
||||
}
|
||||
|
||||
async function updateChangelog(inputPath, outputPath, newVersion) {
|
||||
const lines = await readFileLines(inputPath);
|
||||
|
||||
let unreleasedIndex = -1;
|
||||
let nextVersionIndex = -1;
|
||||
let linksStartIndex = -1;
|
||||
let previousVersion = '';
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
|
||||
if (line.includes('## [Unreleased]')) {
|
||||
unreleasedIndex = i;
|
||||
} else if (
|
||||
nextVersionIndex === -1 &&
|
||||
unreleasedIndex !== -1 &&
|
||||
line.startsWith('## [') &&
|
||||
!line.includes('Unreleased')
|
||||
) {
|
||||
nextVersionIndex = i;
|
||||
const match = line.match(/^## \[([0-9]+\.[0-9]+\.[0-9]+)\]/);
|
||||
if (match) {
|
||||
previousVersion = match[1];
|
||||
}
|
||||
} else if (
|
||||
linksStartIndex === -1 &&
|
||||
line.startsWith('[') &&
|
||||
line.includes(']: https://github.com/')
|
||||
) {
|
||||
linksStartIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (unreleasedIndex === -1) {
|
||||
throw new Error("could not find 'Unreleased' section in changelog");
|
||||
}
|
||||
if (nextVersionIndex === -1 || !previousVersion) {
|
||||
throw new Error(
|
||||
"could not find previous version section after 'Unreleased'",
|
||||
);
|
||||
}
|
||||
if (linksStartIndex === -1) {
|
||||
throw new Error('could not find links section in changelog');
|
||||
}
|
||||
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
|
||||
lines[unreleasedIndex] = `## [${newVersion}] - ${today}`;
|
||||
|
||||
const updatedLinks = updateLinks(
|
||||
lines.slice(linksStartIndex),
|
||||
newVersion,
|
||||
previousVersion,
|
||||
);
|
||||
const updatedContent = lines.slice(0, linksStartIndex).concat(updatedLinks);
|
||||
|
||||
await fs.promises.writeFile(outputPath, updatedContent.join('\n') + '\n');
|
||||
}
|
||||
|
||||
function updateLinks(linkLines, newVersion, previousVersion) {
|
||||
// first link unreleased, second link with the new tag
|
||||
const newLinks = [
|
||||
`[Unreleased]: https://github.com/docker/docker-language-server/compare/v${newVersion}...main`,
|
||||
`[${newVersion}]: https://github.com/docker/docker-language-server/compare/v${previousVersion}...v${newVersion}`,
|
||||
];
|
||||
|
||||
// all other links can be from the original, after skipping the first one
|
||||
for (let i = 1; i < linkLines.length; i++) {
|
||||
newLinks.push(linkLines[i]);
|
||||
}
|
||||
|
||||
return newLinks;
|
||||
}
|
||||
|
||||
async function generateReleaseNotes(filePath) {
|
||||
const lines = await readFileLines(filePath);
|
||||
|
||||
let firstHeader = -1,
|
||||
secondHeader = -1;
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
if (lines[i].startsWith('## ')) {
|
||||
if (firstHeader === -1) {
|
||||
firstHeader = i;
|
||||
} else if (secondHeader === -1) {
|
||||
secondHeader = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (secondHeader === -1) {
|
||||
throw new Error('could not find two ## headers in the changelog');
|
||||
}
|
||||
|
||||
// remove leading and trailing empty newlines
|
||||
const content = lines.slice(firstHeader + 1, secondHeader);
|
||||
while (content.length > 0 && content[0].trim() === '') {
|
||||
content.shift();
|
||||
}
|
||||
while (content.length > 0 && content[content.length - 1].trim() === '') {
|
||||
content.pop();
|
||||
}
|
||||
|
||||
return content.join('\n');
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"comments": {
|
||||
"blockComment": ["/*", "*/"],
|
||||
"lineComment": {
|
||||
"comment": "//",
|
||||
"noIndent": false
|
||||
}
|
||||
},
|
||||
"brackets": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"]
|
||||
],
|
||||
"autoClosingPairs": [
|
||||
{ "open": "{", "close": "}" },
|
||||
{ "open": "[", "close": "]" },
|
||||
{ "open": "(", "close": ")" },
|
||||
{ "open": "\"", "close": "\"", "notIn": ["string"] },
|
||||
{ "open": "/*", "close": " */", "notIn": ["string"] }
|
||||
],
|
||||
"surroundingPairs": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"],
|
||||
["\"", "\""]
|
||||
]
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -2,7 +2,7 @@
|
|||
"name": "docker",
|
||||
"displayName": "Docker DX",
|
||||
"description": "Edit smarter, ship faster with an enhanced Docker-development experience",
|
||||
"version": "0.14.0",
|
||||
"version": "0.15.0",
|
||||
"icon": "resources/logo-256x256.png",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
|
@ -21,7 +21,6 @@
|
|||
"activationEvents": [
|
||||
"onDebugResolve:dockerfile",
|
||||
"onDebugDynamicConfigurations:dockerfile",
|
||||
"onLanguage:dockerbake",
|
||||
"onLanguage:dockercompose",
|
||||
"onLanguage:dockerfile"
|
||||
],
|
||||
|
@ -49,7 +48,8 @@
|
|||
"filenames": [
|
||||
"docker-bake.hcl",
|
||||
"docker-bake.override.hcl"
|
||||
]
|
||||
],
|
||||
"configuration": "./configs/dockerbake-language-configuration.json"
|
||||
}
|
||||
],
|
||||
"grammars": [
|
||||
|
@ -276,7 +276,7 @@
|
|||
"ts-loader": "^9.5.1",
|
||||
"typescript": "^5.4.5",
|
||||
"umd-compat-loader": "^2.1.2",
|
||||
"vscode-extension-tester": "^8.13.0",
|
||||
"vscode-extension-tester": "^8.17.0",
|
||||
"webpack": "^5.92.1",
|
||||
"webpack-cli": "^5.1.4"
|
||||
}
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
import {
|
||||
BottomBarPanel,
|
||||
EditorView,
|
||||
MarkerType,
|
||||
ProblemsView,
|
||||
VSBrowser,
|
||||
} from 'vscode-extension-tester';
|
||||
import * as path from 'path';
|
||||
import { expect } from 'chai';
|
||||
|
||||
describe('Docker Bake', function () {
|
||||
let bottomBar: BottomBarPanel;
|
||||
|
||||
before(async function () {
|
||||
bottomBar = new BottomBarPanel();
|
||||
await bottomBar.toggle(true);
|
||||
});
|
||||
|
||||
after(async function () {
|
||||
await bottomBar.toggle(false);
|
||||
});
|
||||
|
||||
describe('Problems', function () {
|
||||
let view: ProblemsView;
|
||||
|
||||
async function problemsExist(view: ProblemsView) {
|
||||
const markers = await view.getAllVisibleMarkers(MarkerType.Any);
|
||||
return markers.length > 0;
|
||||
}
|
||||
|
||||
before(async function () {
|
||||
this.timeout(30000);
|
||||
|
||||
view = await bottomBar.openProblemsView();
|
||||
|
||||
await VSBrowser.instance.openResources(
|
||||
path.join('test', 'resources', 'docker-bake.hcl'),
|
||||
);
|
||||
|
||||
await view.getDriver().wait(async function () {
|
||||
return await problemsExist(view);
|
||||
}, 15000);
|
||||
});
|
||||
|
||||
after(async function () {
|
||||
await new EditorView().closeAllEditors();
|
||||
});
|
||||
|
||||
it('Bake file has an error about not being able to find an ARG', async function () {
|
||||
const errors = await view.getAllVisibleMarkers(MarkerType.Error);
|
||||
expect(errors.length).equals(1);
|
||||
|
||||
const errorText = await errors[0].getText();
|
||||
expect(errorText).equal(
|
||||
"Error: 'var' not defined as an ARG in your Dockerfile at line 3 and character 9. generated by Docker DX (docker-language-server)",
|
||||
);
|
||||
});
|
||||
|
||||
it('Bake file has no warnings', async function () {
|
||||
const warnings = await view.getAllVisibleMarkers(MarkerType.Warning);
|
||||
expect(warnings).is.empty;
|
||||
});
|
||||
});
|
||||
});
|
|
@ -10,12 +10,21 @@ import * as fs from 'fs';
|
|||
import * as path from 'path';
|
||||
import { expect } from 'chai';
|
||||
|
||||
describe('Dockerfile', function () {
|
||||
async function problemsExist(view: ProblemsView) {
|
||||
const markers = await view.getAllVisibleMarkers(MarkerType.Any);
|
||||
return markers.length > 0;
|
||||
}
|
||||
|
||||
describe('Problems', function () {
|
||||
let bottomBar: BottomBarPanel;
|
||||
let view: ProblemsView;
|
||||
|
||||
before(async function () {
|
||||
this.timeout(30000);
|
||||
bottomBar = new BottomBarPanel();
|
||||
await bottomBar.toggle(true);
|
||||
|
||||
view = await bottomBar.openProblemsView();
|
||||
});
|
||||
|
||||
after(async function () {
|
||||
|
@ -24,18 +33,11 @@ describe('Dockerfile', function () {
|
|||
|
||||
describe('Problems', function () {
|
||||
let editorView: EditorView;
|
||||
let view: ProblemsView;
|
||||
|
||||
async function problemsExist(view: ProblemsView) {
|
||||
const markers = await view.getAllVisibleMarkers(MarkerType.Any);
|
||||
return markers.length > 0;
|
||||
}
|
||||
|
||||
before(async function () {
|
||||
this.timeout(30000);
|
||||
|
||||
editorView = new EditorView();
|
||||
view = await bottomBar.openProblemsView();
|
||||
|
||||
const dockerfilePath = path.join('test', 'resources', 'Dockerfile');
|
||||
fs.writeFileSync(dockerfilePath, 'FROM scratch\nENTRYPOINT ""\n');
|
||||
|
@ -92,4 +94,37 @@ describe('Dockerfile', function () {
|
|||
await editor.save();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Docker Bake', function () {
|
||||
before(async function () {
|
||||
this.timeout(30000);
|
||||
|
||||
await VSBrowser.instance.openResources(
|
||||
path.join('test', 'resources', 'docker-bake.hcl'),
|
||||
);
|
||||
|
||||
await view.getDriver().wait(async function () {
|
||||
return await problemsExist(view);
|
||||
}, 15000);
|
||||
});
|
||||
|
||||
after(async function () {
|
||||
await new EditorView().closeAllEditors();
|
||||
});
|
||||
|
||||
it('Bake file has an error about not being able to find an ARG', async function () {
|
||||
const errors = await view.getAllVisibleMarkers(MarkerType.Error);
|
||||
expect(errors.length).equals(1);
|
||||
|
||||
const errorText = await errors[0].getText();
|
||||
expect(errorText).equal(
|
||||
"Error: 'var' not defined as an ARG in your Dockerfile at line 3 and character 9. generated by Docker DX (docker-language-server)",
|
||||
);
|
||||
});
|
||||
|
||||
it('Bake file has no warnings', async function () {
|
||||
const warnings = await view.getAllVisibleMarkers(MarkerType.Warning);
|
||||
expect(warnings).is.empty;
|
||||
});
|
||||
});
|
||||
});
|
|
@ -3,5 +3,6 @@
|
|||
"git.autoRepositoryDetection": false,
|
||||
"telemetry.telemetryLevel": "off",
|
||||
"workbench.editor.enablePreview": false,
|
||||
"workbench.secondarySideBar.defaultVisibility": "hidden",
|
||||
"workbench.startupEditor": "none"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue