-
Notifications
You must be signed in to change notification settings - Fork 112
Сборка докер-образа v1 и v2 на Jenkins #1565
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
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughThe changes update Dockerfiles for two base image versions, set new environment variables in one Dockerfile, and upgrade the .NET base image in another. The Jenkins pipeline is enhanced with new stages and a function to build and publish Docker images for two flavours, conditional on branch or tag naming. Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant Jenkins
participant DockerHub
Developer->>Jenkins: Pushes code (with tags/branches)
Jenkins->>Jenkins: Detects branch/tag (v1 or v2)
Jenkins->>Jenkins: Triggers "Build v1" or "Build v2" stage
Jenkins->>Jenkins: Calls publishDockerImage(flavour)
Jenkins->>Jenkins: Builds Docker image with correct Dockerfile
Jenkins->>Jenkins: Loads and tags Docker image
Jenkins->>DockerHub: Pushes Docker image
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes detected. Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 код даёт. Сборка, тэги — всё идёт, Разработка процветёт!
docker-build.Jenkinsfile
Outdated
| stage('Build v1') { | ||
| when { | ||
| anyOf { | ||
| branch 'release/latest' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EvilBeaver проверь, плз
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
перевел на latest. вроде бы то, что с релизов, рано или поздно тегируется.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| agent { label 'linux' } | ||
| when { | ||
| anyOf { | ||
| branch 'latest' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
release/latest. Просто latest это аналог develop для v1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Его тогда надо в latest-dev пушить может быть? Для синхронизации с овм
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сейчас jenkinsfile просто неверный, т.к. образ latest будет собираться не при релизе, а при просто коммите в дев-ветку. Отдельно можно наверное завести тэг докера под dev-latest, но это отдельное, в данном случае, просто надо фиксануть ошибку в фильтре ветки.
Closes #1563
С закомментированным пушем на тестовой ветке: https://build.oscript.io/job/docker-publish/job/feature%252Fdocker-build/19/
Summary by CodeRabbit