Сборка докер-образа v1 и v2 на Jenkins#1565
Conversation
WalkthroughAdds PATH-exporting environment variables to Dockerfile_v1, upgrades Dockerfile_v2 base image to .NET 8.0-jammy, and adds parallel "Publishing docker-images" stages plus a new publishDockerImage(flavour, codename) function in the Jenkins pipeline to build and push flavour-specific images. Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant J as Jenkins
participant Reg as Registry
Dev->>J: Push commit or tag
J->>J: Evaluate when conditions (branch/tag)
alt matches v1
J->>J: Run "Build v1" stage
J->>J: publishDockerImage("v1", codename)
end
alt matches v2
J->>J: Run "Build v2" stage
J->>J: publishDockerImage("v2", codename)
end
note right of J `#DDEEEF`: publishDockerImage builds using flavour-specific Dockerfile
J->>Reg: Tag & push evilbeaver/onescript:${codename}
Reg-->>J: Acknowledge push
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
docker-build.Jenkinsfile (1)
47-50: Consistent Docker operations for v2 stage.The v2 build stage uses the same pattern as v1, which provides consistency. However, it inherits the same issues with authentication and error handling.
🧹 Nitpick comments (1)
docker-build.Jenkinsfile (1)
6-8: Consider making Docker username configurable.The hardcoded username should be made configurable through Jenkins credentials or environment variables for better flexibility and security.
environment { - DOCKER_USERNAME = "evilbeaver" + DOCKER_USERNAME = credentials('docker-username') }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
docker-build.Jenkinsfile(1 hunks)install/builders/base-image/Dockerfile_v1(1 hunks)install/builders/base-image/Dockerfile_v2(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: EvilBeaver
PR: EvilBeaver/OneScript#0
File: :0-0
Timestamp: 2024-08-05T18:27:08.563Z
Learning: For each new pull request in the EvilBeaver/OneScript repository, include a poem in Russian.
📚 Learning: use 'dotnet oscript.dll tests/testrunner.os -runall tests' to run acceptance tests...
Learnt from: CR
PR: EvilBeaver/OneScript#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-03T07:12:50.869Z
Learning: Use 'dotnet oscript.dll tests/testrunner.os -runAll tests' to run acceptance tests
Applied to files:
install/builders/base-image/Dockerfile_v1
🔇 Additional comments (8)
install/builders/base-image/Dockerfile_v2 (1)
14-14: Confirmed .NET 8.0 support in build configuration
- Build.csproj defines
<ActiveFramework>net8.0</ActiveFramework>.- TestApp.csproj targets
net8.0-windows.- No remaining references to .NET 6.0 in project files.
The Docker base image update (
aspnet:6.0-jammy→aspnet:8.0-jammy) now matches the solution’s .NET 8.0 targets. No further action needed.install/builders/base-image/Dockerfile_v1 (2)
11-11: Line continuation added correctly.The backslash continuation is properly added to maintain the RUN command structure.
13-14: Validate ovm symlink path consistencyThe
ENV OSCRIPTBINandPATHsettings in Dockerfile_v1 correctly aim to expose the ovm binaries, but they rely on a hardcoded/root/.local/share/ovm/current/bin. In contrast, Dockerfile_v2 pulls directly from the versioned directory (/root/.local/share/ovm/${VERSION}/) into/var/oscript.Please verify that running
mono ovm.exe use --install $VERSIONactually creates a
currentsymlink under~/.local/share/ovmpointing at the installed version’s folder. If no such symlink exists, you should either:
- Update Dockerfile_v1 to consume the version directory directly (e.g. add
ARG VERSIONand use/root/.local/share/ovm/${VERSION}/bin), or- Adopt the v2 approach:
COPY --from=0 /root/.local/share/ovm/${VERSION}/ /var/oscript/andENV PATH="$PATH:/var/oscript/bin"for consistency across builds.Points to verify:
- Check the ovm documentation or a local install to confirm
use --installcreates.../ovm/current/bin.- Ensure both Dockerfiles follow a consistent installation pattern.
docker-build.Jenkinsfile (5)
12-19: Build v1 condition logic is correct.The conditional logic properly handles both branch-based (
release/latest) and tag-based (v1.*) triggers for the v1 build stage.
22-23: Tag naming strategy aligns with objectives.The dynamic tag assignment (using TAG_NAME or defaulting to 'latest') properly supports the requirement for publishing dev, latest, and numbered release versions.
34-41: Build v2 condition logic is correct.The conditional logic properly handles both branch-based (
develop) and tag-based (v2.*) triggers for the v2 build stage.
44-44: Appropriate default tag for v2 builds.Using 'dev' as the default tag for v2 builds from the develop branch is appropriate and aligns with the development workflow.
1-55: Pipeline successfully implements automatic Docker publishing objectives.This Jenkins pipeline effectively addresses the PR objectives by automating Docker image publishing for different release channels (dev, latest, numbered versions). The two-stage approach allows for separate v1 and v2 image lifecycles.
Russian poem as requested:
Докер-образы теперь летят, Дженкинс строит их подряд. v1, v2 — версий парад, Автоматизации клад! OneScript в контейнерах живёт, EvilBeaver код даёт. Сборка, тэги — всё идёт, Разработка процветёт!
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
Jenkinsfile(4 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: EvilBeaver
PR: EvilBeaver/OneScript#0
File: :0-0
Timestamp: 2024-08-05T18:27:08.563Z
Learning: For each new pull request in the EvilBeaver/OneScript repository, include a poem in Russian.
Learnt from: nixel2007
PR: EvilBeaver/OneScript#1565
File: docker-build.Jenkinsfile:25-28
Timestamp: 2025-08-06T07:01:44.782Z
Learning: In the EvilBeaver/OneScript repository, Docker authentication for Jenkins pipelines is configured at the Jenkins settings level, so explicit Docker registry authentication (like docker.withRegistry) is not needed in Jenkinsfiles.
📚 Learning: in the evilbeaver/onescript repository, docker authentication for jenkins pipelines is configured at...
Learnt from: nixel2007
PR: EvilBeaver/OneScript#1565
File: docker-build.Jenkinsfile:25-28
Timestamp: 2025-08-06T07:01:44.782Z
Learning: In the EvilBeaver/OneScript repository, Docker authentication for Jenkins pipelines is configured at the Jenkins settings level, so explicit Docker registry authentication (like docker.withRegistry) is not needed in Jenkinsfiles.
Applied to files:
Jenkinsfile
d05c5fc to
74f7670
Compare
74f7670 to
be55753
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds automated Docker image building and publishing to the Jenkins CI/CD pipeline for both v1 and v2 versions of OneScript. The changes support building different image flavors based on branches and tags, with v1 targeting stable releases and v2 targeting development builds.
Key changes:
- Added a new Jenkins pipeline stage to build and publish Docker images in parallel for v1 and v2 flavors
- Updated base Docker images: v1 now includes environment variables for executable paths, v2 upgraded to .NET 8.0
- Reformatted
whenconditions in existing pipeline stages for consistency
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Jenkinsfile | Added new parallel stage for building Docker images with branch/tag-based conditions and a helper function to build and push images |
| install/builders/base-image/Dockerfile_v1 | Added PATH environment variables to make oscript executables available in the container |
| install/builders/base-image/Dockerfile_v2 | Upgraded base image from .NET 6.0 to 8.0 for improved compatibility |
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
Jenkinsfile(4 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: EvilBeaver
Repo: EvilBeaver/OneScript PR: 0
File: :0-0
Timestamp: 2024-08-05T18:27:08.563Z
Learning: For each new pull request in the EvilBeaver/OneScript repository, include a poem in Russian.
Learnt from: nixel2007
Repo: EvilBeaver/OneScript PR: 1565
File: docker-build.Jenkinsfile:25-28
Timestamp: 2025-08-06T07:01:44.814Z
Learning: In the EvilBeaver/OneScript repository, Docker authentication for Jenkins pipelines is configured at the Jenkins settings level, so explicit Docker registry authentication (like docker.withRegistry) is not needed in Jenkinsfiles.
📚 Learning: 2025-08-06T07:01:44.814Z
Learnt from: nixel2007
Repo: EvilBeaver/OneScript PR: 1565
File: docker-build.Jenkinsfile:25-28
Timestamp: 2025-08-06T07:01:44.814Z
Learning: In the EvilBeaver/OneScript repository, Docker authentication for Jenkins pipelines is configured at the Jenkins settings level, so explicit Docker registry authentication (like docker.withRegistry) is not needed in Jenkinsfiles.
Applied to files:
Jenkinsfile
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: SonarQube
- GitHub Check: SonarQube
🔇 Additional comments (3)
Jenkinsfile (3)
267-274: Verify branch filtering logic aligns with release strategy.The condition for v1 uses
branch 'release/latest', while v2 usesbranch 'develop'. Per the PR objectives, ensure this reflects the intended publishing channels (v1 → "latest", v2 → "dev"). Verify with the team that the branch names are correct and that no other release branches (e.g.,release/preview) should trigger Docker builds.
275-280: Approve v1 build stage structure.The
stage('Build v1')block is well-formed: correct agent label, proper when conditions, and explicit script wrapping the docker call.
202-206: Approve formatting changes towhenblocks.The refactoring of the
whenblocks in "Publishing night-build" (lines 202–206) and "Publishing preview" (lines 220–224) preserves functional behavior while improving consistency.Also applies to: 220-224
| def publishDockerImage(flavour, codename) { | ||
| def imageName = "evilbeaver/onescript:${codename}" | ||
|
|
||
| docker.build( | ||
| imageName, | ||
| "--load -f install/builders/base-image/Dockerfile_${flavour} ." | ||
| ).push() | ||
| } |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
Sanitize Docker tag to prevent invalid characters in image name.
The codename variable derived from branch names or tags may contain characters invalid for Docker tags (e.g., slashes in branch names). While the current conditions (release/latest, develop, tags starting with v1., v2.) appear safe, explicitly sanitizing the tag prevents future regressions if conditions change.
def publishDockerImage(flavour, codename) {
- def imageName = "evilbeaver/onescript:${codename}"
+ def sanitizedTag = codename.replaceAll('[^A-Za-z0-9._-]', '_')
+ def imageName = "evilbeaver/onescript:${sanitizedTag}"
docker.build(
imageName,
"--load -f install/builders/base-image/Dockerfile_${flavour} ."
).push()
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| def publishDockerImage(flavour, codename) { | |
| def imageName = "evilbeaver/onescript:${codename}" | |
| docker.build( | |
| imageName, | |
| "--load -f install/builders/base-image/Dockerfile_${flavour} ." | |
| ).push() | |
| } | |
| def publishDockerImage(flavour, codename) { | |
| def sanitizedTag = codename.replaceAll('[^A-Za-z0-9._-]', '_') | |
| def imageName = "evilbeaver/onescript:${sanitizedTag}" | |
| docker.build( | |
| imageName, | |
| "--load -f install/builders/base-image/Dockerfile_${flavour} ." | |
| ).push() | |
| } |
🤖 Prompt for AI Agents
In Jenkinsfile around lines 344 to 351, the codename is used directly as a
Docker tag but may contain characters invalid for Docker tags; sanitize it by
creating a safeTag: convert to lowercase, replace any character not in
[a-z0-9A-Z_.-] with a hyphen (or remove), collapse consecutive hyphens, trim
leading/trailing dots or hyphens, and truncate to Docker's 128-character limit;
then use this safeTag when building/pushing the image instead of the raw
codename.

0 New Issues
0 Fixed Issues
0 Accepted Issues
No data about coverage
Closes #1563
С закомментированным пушем на тестовой ветке: https://build.oscript.io/job/docker-publish/job/feature%252Fdocker-build/19/
Summary by CodeRabbit
Chores
New Features
✏️ Tip: You can customize this high-level summary in your review settings.