Skip to content

Conversation

@nixel2007
Copy link
Collaborator

@nixel2007 nixel2007 commented Aug 6, 2025

Closes #1563

С закомментированным пушем на тестовой ветке: https://build.oscript.io/job/docker-publish/job/feature%252Fdocker-build/19/

Summary by CodeRabbit

  • Chores
    • Updated environment variables in the base image to improve executable availability.
    • Upgraded the base image to use a newer .NET version for improved compatibility.
    • Enhanced the CI pipeline with clearer branch conditions and added automated Docker image build and publish steps for multiple versions.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 6, 2025

Walkthrough

The 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

Cohort / File(s) Change Summary
Dockerfile v1: Env Vars
install/builders/base-image/Dockerfile_v1
Adds OSCRIPTBIN environment variable and extends PATH to include its directory after engine install.
Dockerfile v2: Base Image Update
install/builders/base-image/Dockerfile_v2
Updates base image from .NET 6.0 to .NET 8.0; no other modifications.
Jenkins Pipeline: Docker Image Publishing
Jenkinsfile
Refactors branch conditions in publishing stages, adds "Publishing docker-images" group with "Build v1" and "Build v2" stages, introduces publishDockerImage function to build and push Docker images per flavour.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Assessment against linked issues

Objective Addressed Explanation
Enable automatic publishing of Docker images for engine for dev, latest, and numbered releases (#1563)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes detected.

Poem

A Jenkins hop, a Docker spin,
Two flavours built, let tags begin!
The v1 and v2 bunnies race,
To DockerHub, they find their place.
With envs and builds now all in sync,
This rabbit gives a happy wink! 🐇🚀

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between be55753 and e6fb819.

📒 Files selected for processing (1)
  • Jenkinsfile (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Jenkinsfile
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/docker-build

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@nixel2007 nixel2007 requested a review from EvilBeaver August 6, 2025 06:56
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between bd9b7e4 and e17fe9a.

📒 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-jammyaspnet: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 consistency

The ENV OSCRIPTBIN and PATH settings 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 $VERSION

actually creates a current symlink under ~/.local/share/ovm pointing 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 VERSION and use /root/.local/share/ovm/${VERSION}/bin), or
  • Adopt the v2 approach: COPY --from=0 /root/.local/share/ovm/${VERSION}/ /var/oscript/ and ENV PATH="$PATH:/var/oscript/bin" for consistency across builds.

Points to verify:

  • Check the ovm documentation or a local install to confirm use --install creates .../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 код даёт.
Сборка, тэги — всё идёт,
Разработка процветёт!

stage('Build v1') {
when {
anyOf {
branch 'release/latest'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EvilBeaver проверь, плз

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

перевел на latest. вроде бы то, что с релизов, рано или поздно тегируется.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between e17fe9a and d05c5fc.

📒 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

@nixel2007 nixel2007 force-pushed the feature/docker-build branch from d05c5fc to 74f7670 Compare August 7, 2025 05:43
@nixel2007 nixel2007 force-pushed the feature/docker-build branch from 74f7670 to be55753 Compare August 7, 2025 05:57
agent { label 'linux' }
when {
anyOf {
branch 'latest'
Copy link
Owner

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Его тогда надо в latest-dev пушить может быть? Для синхронизации с овм

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сейчас jenkinsfile просто неверный, т.к. образ latest будет собираться не при релизе, а при просто коммите в дев-ветку. Отдельно можно наверное завести тэг докера под dev-latest, но это отдельное, в данном случае, просто надо фиксануть ошибку в фильтре ветки.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Публиковать образы docker при сборках

3 participants