Skip to content

Commit f4d7a76

Browse files
committed
✨ implement pointer method for downstreaming
Signed-off-by: David Zager <david.j.zager@gmail.com>
0 parents  commit f4d7a76

File tree

16 files changed

+1161
-0
lines changed

16 files changed

+1161
-0
lines changed

.claude/settings.local.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"WebFetch(domain:github.com)"
5+
]
6+
}
7+
}

.github/workflows/ci.yml

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
name: MTA CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release-*
8+
- 'feature/**'
9+
pull_request:
10+
branches:
11+
- main
12+
- release-*
13+
workflow_dispatch:
14+
inputs:
15+
upstream_ref:
16+
description: 'Override upstream ref (branch, tag, or SHA)'
17+
required: false
18+
type: string
19+
20+
env:
21+
HUSKY: 0
22+
23+
concurrency:
24+
group: mta-ci-${{ github.event_name }}-${{ github.ref }}
25+
cancel-in-progress: true
26+
27+
jobs:
28+
build:
29+
name: Build MTA Extension
30+
runs-on: ubuntu-latest
31+
32+
outputs:
33+
upstream_sha: ${{ steps.build_info.outputs.upstream_sha }}
34+
upstream_sha_short: ${{ steps.build_info.outputs.upstream_sha_short }}
35+
mta_version: ${{ steps.build_info.outputs.mta_version }}
36+
37+
steps:
38+
- name: Checkout MTA build repository
39+
uses: actions/checkout@v4
40+
41+
- name: Setup Node.js
42+
uses: actions/setup-node@v4
43+
with:
44+
node-version: '22'
45+
cache: 'npm'
46+
47+
- name: Install MTA build dependencies
48+
run: npm ci
49+
50+
- name: Pull upstream and apply MTA branding
51+
run: |
52+
if [[ -n "${{ inputs.upstream_ref }}" ]]; then
53+
echo "Using override upstream ref: ${{ inputs.upstream_ref }}"
54+
npm run pull-upstream -- --ref=${{ inputs.upstream_ref }}
55+
else
56+
echo "Using configured upstream ref from mta-build.yaml"
57+
npm run pull-upstream
58+
fi
59+
60+
- name: Extract build info
61+
id: build_info
62+
run: |
63+
cd .upstream-workspace
64+
UPSTREAM_SHA=$(git rev-parse HEAD)
65+
UPSTREAM_SHA_SHORT=$(git rev-parse --short HEAD)
66+
echo "upstream_sha=${UPSTREAM_SHA}" >> $GITHUB_OUTPUT
67+
echo "upstream_sha_short=${UPSTREAM_SHA_SHORT}" >> $GITHUB_OUTPUT
68+
69+
# Get MTA version from transformed package.json
70+
MTA_VERSION=$(node -p "require('./vscode/package.json').version")
71+
echo "mta_version=${MTA_VERSION}" >> $GITHUB_OUTPUT
72+
73+
- name: Display build configuration
74+
run: |
75+
echo "## MTA Build Configuration" >> $GITHUB_STEP_SUMMARY
76+
echo "- **Upstream SHA**: \`${{ steps.build_info.outputs.upstream_sha }}\`" >> $GITHUB_STEP_SUMMARY
77+
echo "- **MTA Version**: \`${{ steps.build_info.outputs.mta_version }}\`" >> $GITHUB_STEP_SUMMARY
78+
79+
- name: Install upstream dependencies
80+
run: |
81+
cd .upstream-workspace
82+
npm ci
83+
84+
- name: Build extension
85+
run: |
86+
cd .upstream-workspace
87+
npm run build
88+
89+
- name: Create distribution and package
90+
run: |
91+
cd .upstream-workspace
92+
npm run dist
93+
npm run package
94+
95+
- name: Upload VSIX artifact
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: mta-vsix-artifact
99+
path: .upstream-workspace/dist/*.vsix
100+
retention-days: 30
101+
102+
publish-development:
103+
name: Publish Development Build
104+
needs: build
105+
runs-on: ubuntu-latest
106+
if: >
107+
${{
108+
!failure() &&
109+
!(github.event_name == 'pull_request' && !github.event.pull_request.merged) &&
110+
!startsWith(github.ref, 'refs/tags/')
111+
}}
112+
113+
steps:
114+
- name: Download VSIX artifact
115+
uses: actions/download-artifact@v4
116+
with:
117+
name: mta-vsix-artifact
118+
path: ./artifacts
119+
120+
- name: Publish to development builds release
121+
run: |
122+
# Find VSIX file
123+
VSIX_FILE=$(find ./artifacts -name "*.vsix" | head -1)
124+
if [[ -z "$VSIX_FILE" ]]; then
125+
echo "Error: No VSIX file found"
126+
exit 1
127+
fi
128+
129+
# Upload to development-builds release
130+
gh release upload development-builds "$VSIX_FILE" --clobber
131+
echo "Published development build: $(basename "$VSIX_FILE")"
132+
env:
133+
GITHUB_TOKEN: ${{ github.token }}
134+
135+
release:
136+
name: Create Release
137+
needs: build
138+
runs-on: ubuntu-latest
139+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
140+
141+
steps:
142+
- name: Download VSIX artifact
143+
uses: actions/download-artifact@v4
144+
with:
145+
name: mta-vsix-artifact
146+
path: ./artifacts
147+
148+
- name: Create GitHub release
149+
run: |
150+
VSIX_FILE=$(find ./artifacts -name "*.vsix" | head -1)
151+
RELEASE_NAME="${{ github.ref_name }}"
152+
153+
gh release create "${{ github.ref_name }}" \
154+
--title "MTA Extension $RELEASE_NAME" \
155+
--notes "Migration Toolkit for Applications extension release $RELEASE_NAME
156+
157+
Built from upstream commit: ${{ needs.build.outputs.upstream_sha_short }}
158+
159+
## Installation
160+
Download the .vsix file and install using 'Extensions: Install from VSIX...' in VS Code." \
161+
"$VSIX_FILE"
162+
env:
163+
GITHUB_TOKEN: ${{ github.token }}

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Node modules
2+
node_modules/
3+
4+
# Upstream workspace (generated by pull-upstream)
5+
.upstream-workspace/
6+
7+
# Build artifacts
8+
dist/
9+
build/
10+
out/
11+
*.vsix
12+
13+
# OS
14+
.DS_Store
15+
Thumbs.db
16+
17+
# IDE
18+
.vscode/
19+
.idea/
20+
*.swp
21+
*.swo
22+
23+
# Logs
24+
*.log
25+
npm-debug.log*
26+
yarn-debug.log*
27+
yarn-error.log*
28+
29+
# Environment
30+
.env
31+
.env.local
32+
.env.development.local
33+
.env.test.local
34+
.env.production.local
35+
36+
# Temporary files
37+
*.tmp
38+
.tmp/

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22

README.md

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# MTA VSCode Extension (Release-0.2 Build)
2+
3+
This repository contains the build configuration and scripts to create Migration Toolkit for Applications (MTA) branded VSCode extensions based on the `release-0.2` branch of `konveyor/editor-extensions`.
4+
5+
## Overview
6+
7+
This implements a "pointer build" strategy where:
8+
- We track a specific commit from `konveyor/editor-extensions` release-0.2 branch
9+
- We apply MTA branding during the build process via prebuild hooks
10+
- We produce `mta-vscode-extension` VSIX files ready for distribution
11+
12+
## Quick Start
13+
14+
1. **Install dependencies**:
15+
```bash
16+
npm install
17+
```
18+
19+
2. **Pull upstream and prepare workspace**:
20+
```bash
21+
npm run pull-upstream
22+
```
23+
24+
3. **Build the MTA extension**:
25+
```bash
26+
cd .upstream-workspace
27+
npm ci
28+
npm run build
29+
npm run dist
30+
npm run package
31+
```
32+
33+
The resulting `.vsix` file will be in `.upstream-workspace/dist/`.
34+
35+
## Configuration
36+
37+
### mta-build.yaml
38+
39+
The main configuration file that defines:
40+
- Which upstream commit to build from
41+
- MTA branding settings (version, publisher, URLs)
42+
- Asset mappings
43+
44+
### Updating Upstream Reference
45+
46+
To update to a newer commit from release-0.2:
47+
48+
```bash
49+
./scripts/update-upstream.sh release-0.2
50+
```
51+
52+
To use a specific tag:
53+
54+
```bash
55+
./scripts/update-upstream.sh v0.2.1
56+
```
57+
58+
## Development Workflow
59+
60+
### Local Development
61+
62+
1. Pull upstream: `npm run pull-upstream`
63+
2. Enter workspace: `cd .upstream-workspace`
64+
3. Install deps: `npm ci`
65+
4. Start dev mode: `npm run dev`
66+
67+
### Making Changes
68+
69+
- **Branding changes**: Edit `scripts/apply-branding.js`
70+
- **Assets**: Add files to `assets/branding/` directory
71+
- **Upstream version**: Use `./scripts/update-upstream.sh`
72+
73+
### Testing
74+
75+
Test the full build process:
76+
77+
```bash
78+
npm run pull-upstream
79+
cd .upstream-workspace
80+
npm ci
81+
npm run build
82+
npm run package
83+
```
84+
85+
Install the resulting `.vsix` in VSCode to verify branding.
86+
87+
## CI/CD
88+
89+
The `.github/workflows/ci.yml` workflow:
90+
91+
1. **Triggers**: On push to `release-0.2` branch, PRs, or manual dispatch
92+
2. **Process**: Pull upstream → Apply branding → Build → Package → Test
93+
3. **Artifacts**: Uploads `.vsix` files
94+
4. **Publishing**:
95+
- Development builds → `development-builds` release
96+
- Tagged releases → Full GitHub releases
97+
98+
## Directory Structure
99+
100+
```
101+
migtools-release02/
102+
├── mta-build.yaml # Main configuration
103+
├── package.json # Build orchestrator
104+
├── scripts/
105+
│ ├── pull-upstream.js # Fetch and prepare upstream code
106+
│ ├── apply-branding.js # Apply MTA branding transformations
107+
│ └── update-upstream.sh # Update upstream reference
108+
├── assets/
109+
│ ├── branding/ # MTA-specific assets
110+
│ │ ├── sidebar-icons/ # VSCode activity bar icons
111+
│ │ ├── avatars/ # Webview avatar images
112+
│ │ └── README.md # Extension marketplace description
113+
│ └── README.md # Asset documentation
114+
├── .github/workflows/
115+
│ └── ci.yml # Build and release automation
116+
└── .upstream-workspace/ # Generated workspace (gitignored)
117+
```
118+
119+
## Asset Requirements
120+
121+
For full branding, provide these assets:
122+
123+
- `assets/branding/sidebar-icons/icon.png` - VSCode activity bar icon
124+
- `assets/branding/avatars/avatar.svg` - Webview UI avatar
125+
- `assets/branding/README.md` - Extension marketplace description
126+
127+
If assets are missing, the build will continue with warnings.
128+
129+
## Troubleshooting
130+
131+
### Clean Start
132+
133+
```bash
134+
npm run clean
135+
npm run pull-upstream
136+
```
137+
138+
### Workspace Issues
139+
140+
```bash
141+
rm -rf .upstream-workspace
142+
npm run pull-upstream
143+
```
144+
145+
### Build Failures
146+
147+
Check that you have the correct Node.js version:
148+
```bash
149+
node --version # Should be 18+
150+
```
151+
152+
## Architecture Notes
153+
154+
This release-0.2 build targets the **single-extension** architecture of the upstream release-0.2 branch, which has:
155+
156+
- Single extension at `vscode/package.json`
157+
- Simpler build process (no multi-extension complexity)
158+
- Different dependency versions than main branch
159+
160+
This is in contrast to the `main` branch which uses a multi-extension architecture.
161+
162+
## Contributing
163+
164+
1. Fork this repository
165+
2. Create a feature branch
166+
3. Test changes with `npm run pull-upstream && cd .upstream-workspace && npm ci && npm run build`
167+
4. Submit a pull request
168+
169+
## License
170+
171+
Apache 2.0 - see [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)