-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(manager): upgrade GCP to Ubuntu 24.04 and update Docker packages #2711
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1d7f95b
feat(manager): upgrade GCP to Ubuntu 24.04 and update Docker packages
fortuna 3188b69
Add full GCP region location metadata
fortuna d863e2b
Update server_manager/install_scripts/gcp_install_server.sh
fortuna 0cec64b
Apply suggestion from @Copilot
fortuna c69f387
Sort cloud location picker options deterministically
fortuna b9b4412
Add and sort geo location messages
fortuna ec76434
Document cloud location update workflow
fortuna 7b18f2c
Fix lint
fortuna df8e18d
Refactor lint workflow to changed-line Node gate
fortuna 02cc091
Merge branch 'master' into upgrade-server-images
fortuna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| // Copyright 2026 The Outline Authors | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| import {existsSync, readFileSync} from 'node:fs'; | ||
| import path from 'node:path'; | ||
| import {spawnSync} from 'node:child_process'; | ||
|
|
||
| function getRequiredEnv(name) { | ||
| const value = process.env[name]; | ||
| if (!value) { | ||
| throw new Error(`${name} is required`); | ||
| } | ||
| return value; | ||
| } | ||
|
|
||
| function parseFileList(value) { | ||
| return value.trim().split(/\s+/).filter(Boolean); | ||
| } | ||
|
|
||
| function normalizePath(filePath) { | ||
| return path.isAbsolute(filePath) | ||
| ? path.relative(process.cwd(), filePath) | ||
| : filePath; | ||
| } | ||
|
|
||
| function getChangedLineSet(baseCommit, headCommit, file) { | ||
| const result = spawnSync( | ||
| 'git', | ||
| ['diff', '--unified=0', '--no-color', baseCommit, headCommit, '--', file], | ||
| {encoding: 'utf8'} | ||
| ); | ||
| if (result.status !== 0) { | ||
| throw new Error(`git diff failed for ${file}: ${result.stderr}`); | ||
| } | ||
|
|
||
| const lines = new Set(); | ||
| const hunkRegExp = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/; | ||
| for (const line of result.stdout.split('\n')) { | ||
| const match = line.match(hunkRegExp); | ||
| if (!match) { | ||
| continue; | ||
| } | ||
| const start = Number.parseInt(match[1], 10); | ||
| const count = Number.parseInt(match[2] || '1', 10); | ||
| for (let i = 0; i < count; i++) { | ||
| lines.add(start + i); | ||
| } | ||
| } | ||
| return lines; | ||
| } | ||
|
|
||
| function getLine(message, key) { | ||
| const line = message[key]; | ||
| return Number.isInteger(line) ? line : null; | ||
| } | ||
|
|
||
| function main() { | ||
| const baseCommit = getRequiredEnv('BASE_COMMIT'); | ||
| const headCommit = getRequiredEnv('HEAD_COMMIT'); | ||
| const lintResultsPath = process.env.LINT_RESULTS_PATH || 'lint-results.json'; | ||
| const files = [ | ||
| ...parseFileList(process.env.MODIFIED_FILES || ''), | ||
| ...parseFileList(process.env.ADDED_FILES || ''), | ||
| ]; | ||
|
|
||
| if (!files.length) { | ||
| return; | ||
| } | ||
| if (!existsSync(lintResultsPath)) { | ||
| throw new Error(`Missing lint results file: ${lintResultsPath}`); | ||
| } | ||
|
|
||
| const changedLinesByFile = new Map( | ||
| files.map(file => [file, getChangedLineSet(baseCommit, headCommit, file)]) | ||
| ); | ||
| const lintResults = JSON.parse(readFileSync(lintResultsPath, 'utf8')); | ||
| const blockingIssues = []; | ||
|
|
||
| for (const fileResult of lintResults) { | ||
| const file = normalizePath(fileResult.filePath); | ||
| const changedLines = changedLinesByFile.get(file); | ||
| if (!changedLines) { | ||
| continue; | ||
| } | ||
|
|
||
| for (const message of fileResult.messages || []) { | ||
| if (!(message.severity === 2 || message.fatal)) { | ||
| continue; | ||
| } | ||
|
|
||
| const line = getLine(message, 'line'); | ||
| const endLine = getLine(message, 'endLine') || line; | ||
| if (!line) { | ||
| // File-level parse/config errors. | ||
| blockingIssues.push({file, line: 1, message}); | ||
| continue; | ||
| } | ||
|
|
||
| let intersectsChangedLines = false; | ||
| for (let current = line; current <= endLine; current++) { | ||
| if (changedLines.has(current)) { | ||
| intersectsChangedLines = true; | ||
| break; | ||
| } | ||
| } | ||
| if (intersectsChangedLines) { | ||
| blockingIssues.push({file, line, message}); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (!blockingIssues.length) { | ||
| console.log('No lint errors found on changed lines.'); | ||
| return; | ||
| } | ||
|
|
||
| for (const issue of blockingIssues) { | ||
| const rule = issue.message.ruleId || 'lint'; | ||
| const text = issue.message.message.replace(/\r?\n/g, ' '); | ||
| console.log( | ||
| `::error file=${issue.file},line=${issue.line},title=${rule}::${text}` | ||
| ); | ||
| } | ||
|
|
||
| console.error( | ||
| `Found ${blockingIssues.length} lint error(s) on changed lines.` | ||
| ); | ||
| process.exit(1); | ||
| } | ||
|
|
||
| main(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,8 @@ jobs: | |
| steps: | ||
| - name: Checkout | ||
| uses: actions/[email protected] | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Install Node | ||
| uses: actions/setup-node@v3 | ||
|
|
@@ -55,7 +57,35 @@ jobs: | |
| **/*.cjs | ||
| **/*.mjs | ||
|
|
||
| - name: Lint | ||
| - name: Set base and head commits | ||
| id: commits | ||
| run: | | ||
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | ||
| base_commit="${{ github.event.pull_request.base.sha }}" | ||
| else | ||
| base_commit="${{ github.event.before }}" | ||
| # Handle edge cases where "before" is empty or all-zero (e.g. first push). | ||
| if [[ -z "$base_commit" || "$base_commit" =~ ^0+$ ]]; then | ||
| base_commit="$(git rev-list --max-parents=0 HEAD)" | ||
| fi | ||
| fi | ||
| echo "base_commit=$base_commit" >> "$GITHUB_OUTPUT" | ||
| echo "head_commit=${{ github.sha }}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Lint changed files | ||
| if: ${{ steps.changed-files.outputs.modified_files_count > 0 || steps.changed-files.outputs.added_file_count > 0 }} | ||
| run: | | ||
| npx eslint -f json -o lint-results.json \ | ||
| ${{ steps.changed-files.outputs.modified_files }} \ | ||
| ${{ steps.changed-files.outputs.added_files }} || true | ||
|
|
||
| - name: Fail on issues in changed lines | ||
| if: ${{ steps.changed-files.outputs.modified_files_count > 0 || steps.changed-files.outputs.added_file_count > 0 }} | ||
| run: npx gts lint ${{ steps.changed-files.outputs.modified_files }} ${{ steps.changed-files.outputs.added_files }} | ||
| env: | ||
| BASE_COMMIT: ${{ steps.commits.outputs.base_commit }} | ||
| HEAD_COMMIT: ${{ steps.commits.outputs.head_commit }} | ||
| MODIFIED_FILES: ${{ steps.changed-files.outputs.modified_files }} | ||
| ADDED_FILES: ${{ steps.changed-files.outputs.added_files }} | ||
| LINT_RESULTS_PATH: lint-results.json | ||
| run: node .github/scripts/fail_on_changed_line_lint.mjs | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.