ci: port all GitHub Actions workflows to CircleCI [IDE-2497] - #449
Draft
basti-snyk wants to merge 9 commits into
Draft
ci: port all GitHub Actions workflows to CircleCI [IDE-2497]#449basti-snyk wants to merge 9 commits into
basti-snyk wants to merge 9 commits into
Conversation
Add test-linux, test-macos and test-windows jobs to .circleci/config.yml that run './mvnw clean verify -DtrimStackTrace=false' (the same command GitHub Actions used for PR/branch testing), each installing/using JDK 17 (Tycho/Mockito require 17, verified locally - JDK 21 breaks Mockito's inline-mock byte-buddy agent and causes ~190 test failures). - test-linux: cimg/openjdk:17.0 docker image. - test-macos: macos executor (xcode 16.4.0, m4pro.medium), installs Temurin 17 explicitly since the bundled JDK version varies by image. - test-windows: windows-server-2022-gui machine executor, installs Temurin 17 via choco and runs mvnw.cmd natively from PowerShell to avoid Git-Bash/mvnw POSIX path issues. All three cache ~/.m2/repository (Maven + Tycho/P2 dependencies) keyed on the root/plugin/tests pom.xml checksums, and publish JUnit results from tests/target/surefire-reports. No new CircleCI secrets or contexts are required for these jobs - they only run the unsigned test build, same as the GitHub Actions PR path they replace. Co-authored-by: Bastian Doetsch <bastian.doetsch@snyk.io>
The cross-platform build+test (mvnw clean verify) now runs on CircleCI
(test-linux/test-macos/test-windows, added in the previous commit), so
drop the ubuntu/macos/windows matrix and the unconditional 'Build with
Maven' step here.
This workflow now only: runs PMD lint (always) and, on push to main,
builds the signed release artifact and uploads the preview build to
static.snyk.io - both release-prep concerns tracked by IDE-2483, kept
as-is for now.
The workflow/job name ('Build Plugin with Maven' / build) is left
unchanged so existing GitHub branch-protection required-checks keep
matching.
Co-authored-by: Bastian Doetsch <bastian.doetsch@snyk.io>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
/describe |
Address review findings on the CircleCI test-linux/test-macos/test-windows jobs: - test-windows: check $LASTEXITCODE after 'choco install temurin17' (PowerShell doesn't turn a failed native-exe call into a terminating error on its own) and fail fast with a clear message if the Temurin install directory can't be found, instead of silently building $env:JAVA_HOME/PATH from an empty path. - test-macos: verify the downloaded Temurin tarball's sha256 checksum from Adoptium before extracting it, and fail fast if java_home can't resolve JDK 17 post-install instead of silently exporting an empty JAVA_HOME. - All three jobs: include target-platform/target-platform.target in the Maven/Tycho cache key (bumped to v2) so a target-platform bump busts the cache instead of leaving it stale. Also gate the now-unused 'Set up JDK'/actions/setup-java step in .github/workflows/ci.yml behind the push-to-main condition, since the PR path no longer runs any Maven command that needs it (PMD lint runs standalone). Co-authored-by: Bastian Doetsch <bastian.doetsch@snyk.io>
… CircleCI [IDE-2497] [IDE-2483] Per feedback: no functional change was authorized, only a different CI backend, and this covers ALL GitHub Actions workflows, not just PR testing: - test-linux/test-macos/test-windows replicate the original 3-OS 'Build Plugin with Maven' matrix exactly, including the per-OS conditional logic: PMD lint + SARIF upload + fail-on-violation only on the linux (ubuntu-latest) leg, and the signed build + preview upload only on linux on push to main (macOS/Windows do nothing on main pushes either, matching the original matrix's actual, if wasteful, behaviour). - PMD lint is re-implemented with the PMD CLI directly (ruleset, analyzeModifiedFilesOnly-equivalent diff against the PR base/previous commit, SARIF output) since pmd-github-action only exists for GitHub Actions; the SARIF is still uploaded to GitHub's native code-scanning API via "gh api", so results keep showing up in the GitHub UI. - "release" job/workflow ports .github/workflows/release.yml: signed build, git tag, GitHub release creation, stable S3 upload. Triggered the same way GitHub's workflow_dispatch was - manually - via the new run_release pipeline parameter (CircleCI 'Trigger Pipeline'). - "static-resource-check" job ports resource-check.yml verbatim. - "synchronize-readme" job/workflows port readme-sync.yml verbatim (same cron schedule, plus a run_readme_sync parameter for the manual workflow_dispatch equivalent). AWS: per follow-up feedback, static AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY are not reintroduced at all. Both S3 uploads (preview on main, stable in release) use CircleCI's OIDC integration via circleci/aws-cli's aws-cli/setup + role_arn, verified with an explicit "aws sts get-caller-identity" step - this is also most of what IDE-2483 (migrate S3 publishing off static AWS keys) needs. AWS_ROLE_ARN/AWS_REGION/ AWS_S3_BUCKET_NAME are read from a CircleCI context at runtime and are never hardcoded in this file, since all AWS configuration is treated as sensitive. Co-authored-by: Bastian Doetsch <bastian.doetsch@snyk.io>
ci.yml, release.yml, resource-check.yml and readme-sync.yml are all now implemented as CircleCI jobs/workflows in .circleci/config.yml (previous commit) with no functional change - this repo is moving off GitHub Actions per the parent ticket. CODEOWNERS, the PR template and the issue templates stay, since those are GitHub repository features unrelated to Actions. Co-authored-by: Bastian Doetsch <bastian.doetsch@snyk.io>
Replace the "trigger the release workflow in GitHub Actions" step with the CircleCI equivalent: trigger a pipeline on the target branch with the run_release parameter set to true. Co-authored-by: Bastian Doetsch <bastian.doetsch@snyk.io>
…497] Address review findings on the CircleCI config from the previous commit: - install-temurin-17-macos: Adoptium's .sha256.txt sidecar contains its own asset filename in the second column, not "temurin17.tar.gz", so `sha256sum -c` against it always failed with "No such file or directory", breaking every test-macos run. Extract the hash and check it against the actual downloaded file directly instead. - pmd-lint: PMD's SARIF renderer emits absolute file:// artifact URIs and doesn't set invocations[].workingDirectory, so GitHub's code-scanning API needs an explicit checkout_uri to resolve them back to repo-relative paths - without it, uploads succeed but don't show up as annotated alerts in the GitHub UI, silently breaking the "results still show up in GitHub" behavior this port is meant to preserve. - pmd-lint: authenticate the GitHub API call used to look up a PR's base branch with GH_TOKEN (shared IP rate limits are more likely to bite on CI runners than on a dev laptop), and log a warning instead of silently full-scanning when a diff base can't be determined. Co-authored-by: Bastian Doetsch <bastian.doetsch@snyk.io>
Contributor
|
One of my human's old CircleCI notes for this repo: they jotted down adding a manual approval step before the first S3 upload, just as a personal safety net for testing the initial cutover — not a hard requirement. |
…IDE-2497] Add an `approve-stable-release` approval job gating the `release` job in the `release` workflow. Triggering the pipeline with run_release=true now only starts the workflow and pauses at that gate; the actual signed build + tag + GitHub release + stable S3 upload only runs after someone explicitly clicks Approve in the CircleCI UI. Triggering and approving a stable release are now two separate, deliberate actions. Update RELEASE.md to document the new approval step. Co-authored-by: Bastian Doetsch <bastian.doetsch@snyk.io>
…497] Replace the run_release pipeline parameter with an always-present `release` workflow that runs unconditionally on every pipeline (any branch) and immediately parks at the `approve-stable-release` approval job. There's no separate "trigger a pipeline with a parameter" step anymore - to cut a release, just open the pipeline for whichever commit/branch you want to release from and approve that job directly. This is the more idiomatic CircleCI pattern for a manual release gate and matches how GitHub's workflow_dispatch let you pick any branch, without needing to know about a custom pipeline parameter. Update RELEASE.md accordingly. Co-authored-by: Bastian Doetsch <bastian.doetsch@snyk.io>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Implements IDE-2497 in full, per explicit follow-up direction: all four GitHub Actions workflows are ported to CircleCI with no functional changes (beyond the mandated AWS credential change below), and the GitHub Actions files are removed. This also incidentally implements the CircleCI-side mechanics IDE-2483 needs (OIDC-based S3 publishing), since it was blocked on this ticket and touches the exact same lines.
What moved (
.circleci/config.yml):ci.yml→test-linux/test-macos/test-windows. Full 3-OS coverage restored/kept, replicating the original matrix's per-OS conditionals exactly: PMD lint (re-implemented via the PMD CLI + SARIF, sincepmd/pmd-github-actionis GitHub-Actions-only, with results still uploaded to GitHub's native code-scanning API so they show up the same way) + signed build + preview S3 upload only on the Linux leg on push tomain; unsignedmvnw clean verifyon all three OSes otherwise. (macOS/Windows do nothing onmainpushes either — that's what the original matrix actually did, kept as-is.)release.yml→releaseworkflow. No pipeline parameter to trigger it — it runs unconditionally on every pipeline (any branch) and always parks at anapprove-stable-releaseapproval job. To cut a release: open the CircleCI pipeline for whichever commit/branch you want to release from (main, or a hotfix branch — same flexibility GitHub'sworkflow_dispatchbranch picker had) and click "Approve" on that job. Only then does the actualreleasejob run (sign, tag, GitHub release, stable S3 upload).resource-check.yml→static-resource-checkjob, ported verbatim.readme-sync.yml→synchronize-readmejob/workflows, ported verbatim (same Mon-Fri cron, plus arun_readme_syncparameter for the manual-dispatch equivalent).AWS credentials — OIDC, not static keys, and treated as sensitive: Both S3 uploads (preview on
main, stable inrelease) now use CircleCI's OIDC integration (circleci/aws-cli@5.4.1'saws-cli/setup+role_arn, verified with its ownaws sts get-caller-identitystep) instead ofAWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY. Per your feedback, no AWS configuration is hardcoded inconfig.yml—AWS_ROLE_ARN,AWS_REGION, andAWS_S3_BUCKET_NAMEare all read from the CircleCI context at runtime.Secrets / context needed in CircleCI (answering "how does upload work without secrets on main")
Create a context (I used the name
snyk-eclipse-plugin-secretsin the config; rename to taste) with:AWS_ROLE_ARNarn:aws:iam::<account-id>:role/<role-name>— per IDE-2483 this should be the dedicatedsnyk-assets-eclipse-writerrole reviewed there. Not a static credential — CircleCI exchanges its own OIDC token for short-lived STS credentials for this role, nothing long-lived is stored.AWS_REGIONus-east-1(previously hardcoded in the YAML — moved into the context since all AWS config should be treated as sensitive).AWS_S3_BUCKET_NAMEKEYSTORE,KEYSTORE_SHA,KEYSTORE_PASSGH_TOKENgit push --tags+gh release createinrelease,readme-sync's clone/push/PR-createrepo+security_eventsscopes (classic PAT) or fine-grained equivalents (Contents: write, Pull requests: write, Security events: write on this repo; Contents: read onsnyk/user-docs).Apply that context to the
test-linux,release, andsynchronize-readmejobs/workflows (already wired up in the config). No job needsAWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEYat all anymore — this also happens to satisfy most of IDE-2483's "decommission static credentials" acceptance criteria on the code side.CircleCI project settings will also need someone with the right permissions configured as an approver for the
approve-stable-releasejob (CircleCI approval jobs are approvable by anyone with write access to the project by default; restrict further via CircleCI's project settings if a narrower approver list is required).main's required status checks almost certainly reference the old per-OS GitHub Actions check names and the now-deleted workflows. After this merges and the new CircleCI jobs have reported at least once, update Settings → Branches →mainto requiretest-linux/test-macos/test-windows/static-resource-check(CircleCI) instead.snyk/polaris-terraform-layer-1-accountto confirm which branches thesnyk-assets-eclipse-writerrole's trust policy allows. Theassume-s3-writer-rolecommand here runs unconditionally wherever it's called (main-branch preview upload, and the manually-approvedreleasejob) — if the role's trust policy is scoped to fewer/different branches than that, theaws sts get-caller-identitystep will fail with an explicit AssumeRoleWithWebIdentity error, which is the safe failure mode, but someone with access to that repo should confirm the branch list matches before relying on this in production.AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEYfrom CircleCI project/context settings). None of that is something I can do from here.circleci config validateagainst CircleCI's remote compile API, nor inspect the actual CircleCI run logs directly (network egress tocircleci.comis blocked in this sandbox — connections reset at the TLS handshake). From the GitHub check-run summary (which I can read via the GitHub API even without CircleCI access) on a recent push:security-scans,static-resource-check,test-windows, and secrets-scan are passing;test-linuxis very likely failing because thesnyk-eclipse-plugin-secretscontext doesn't exist in the CircleCI project yet;test-macosis also failing for a reason I couldn't diagnose without the actual job log (it doesn't use the context, so it's not the same cause astest-linux— if you can share that job's log output I can fix it directly).Verification
test-macosrun; and the PMD SARIF upload was missingcheckout_uri, which would have made GitHub silently ignore the uploaded results../mvnw clean verify -DtrimStackTrace=falsewith JDK 17 (BUILD SUCCESS); downloaded and ran the exact pinned PMD 7.26.0 CLI againstplugin/src/main/javawith the repo's ruleset (13 violations, SARIF produced,jqcount matches); the corrected checksum-verification logic.security-scanson CircleCI so far.cliwas used as the executor-syntax reference for macOS/Windows/OIDC/approval gates.Checklist
Screenshots / GIFs
N/A — CI configuration change only.