-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add C++ profile to Docker Compose and Updatecli #377
base: main
Are you sure you want to change the base?
Conversation
Bumps debian from bookworm-20231218 to bookworm-20240110. --- updated-dependencies: - dependency-name: debian dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]>
…dekick/debian-bookworm-20240110 chore(deps): bump debian from bookworm-20231218 to bookworm-20240110 in /dockerfiles/sidekick
chore(jenkins): Updates Jenkins plugins
Bumps [updatecli/updatecli-action](https://github.com/updatecli/updatecli-action) from 2.52.0 to 2.53.0. - [Release notes](https://github.com/updatecli/updatecli-action/releases) - [Commits](updatecli/updatecli-action@v2.52.0...v2.53.0) --- updated-dependencies: - dependency-name: updatecli/updatecli-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
Bumps [anchore/scan-action](https://github.com/anchore/scan-action) from 3.5.0 to 3.6.0. - [Release notes](https://github.com/anchore/scan-action/releases) - [Changelog](https://github.com/anchore/scan-action/blob/main/CHANGELOG.md) - [Commits](anchore/scan-action@1d59d90...0550541) --- updated-dependencies: - dependency-name: anchore/scan-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
chore(jenkins): Updates Jenkins plugins
chore(jenkins): Updates Jenkins plugins
…cli/updatecli-action-2.53.0 chore(deps): bump updatecli/updatecli-action from 2.52.0 to 2.53.0
…e/scan-action-3.6.0 chore(deps): bump anchore/scan-action from 3.5.0 to 3.6.0
Bumps [updatecli/updatecli-action](https://github.com/updatecli/updatecli-action) from 2.53.0 to 2.54.0. - [Release notes](https://github.com/updatecli/updatecli-action/releases) - [Commits](updatecli/updatecli-action@v2.53.0...v2.54.0) --- updated-dependencies: - dependency-name: updatecli/updatecli-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
Bumps debian from bookworm-20240110 to bookworm-20240130. --- updated-dependencies: - dependency-name: debian dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]>
Bumps jenkins/ssh-agent from 5.22.0 to 5.24.0. --- updated-dependencies: - dependency-name: jenkins/ssh-agent dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
Bumps jenkins/ssh-agent from 5.22.0 to 5.24.0. --- updated-dependencies: - dependency-name: jenkins/ssh-agent dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
Bumps jenkins/ssh-agent from 5.22.0 to 5.24.0. --- updated-dependencies: - dependency-name: jenkins/ssh-agent dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
Bumps [release-drafter/release-drafter](https://github.com/release-drafter/release-drafter) from 5 to 6. - [Release notes](https://github.com/release-drafter/release-drafter/releases) - [Commits](release-drafter/release-drafter@v5...v6) --- updated-dependencies: - dependency-name: release-drafter/release-drafter dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]>
Bumps [anchore/scan-action](https://github.com/anchore/scan-action) from 3.6.0 to 3.6.4. - [Release notes](https://github.com/anchore/scan-action/releases) - [Changelog](https://github.com/anchore/scan-action/blob/main/CHANGELOG.md) - [Commits](anchore/scan-action@0550541...3343887) --- updated-dependencies: - dependency-name: anchore/scan-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]>
Bumps jenkins/ssh-agent from 5.22.0 to 5.24.0. --- updated-dependencies: - dependency-name: jenkins/ssh-agent dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
Bumps jenkins/ssh-agent from 5.22.0 to 5.24.0. --- updated-dependencies: - dependency-name: jenkins/ssh-agent dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
Bumps [codacy/codacy-analysis-cli-action](https://github.com/codacy/codacy-analysis-cli-action) from 4.3.0 to 4.4.0. - [Release notes](https://github.com/codacy/codacy-analysis-cli-action/releases) - [Commits](codacy/codacy-analysis-cli-action@5cc54a7...33d4559) --- updated-dependencies: - dependency-name: codacy/codacy-analysis-cli-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
…cli/updatecli-action-2.54.0 chore(deps): bump updatecli/updatecli-action from 2.53.0 to 2.54.0
…dekick/debian-bookworm-20240130 chore(deps): bump debian from bookworm-20240110 to bookworm-20240130 in /dockerfiles/sidekick
…thon/jenkins/ssh-agent-5.24.0 chore(deps): bump jenkins/ssh-agent from 5.22.0 to 5.24.0 in /dockerfiles/python
…ven/jenkins/ssh-agent-5.24.0 chore(deps): bump jenkins/ssh-agent from 5.22.0 to 5.24.0 in /dockerfiles/maven
…e-drafter/release-drafter-6 chore(deps): bump release-drafter/release-drafter from 5 to 6
…e/scan-action-3.6.4 chore(deps): bump anchore/scan-action from 3.6.0 to 3.6.4
…lti/jenkins/ssh-agent-5.24.0 chore(deps): bump jenkins/ssh-agent from 5.22.0 to 5.24.0 in /dockerfiles/multi
chore(jenkins): Updates Jenkins plugins
chore(jenkins): Updates Jenkins plugins
chore(jenkins): Updates Jenkins plugins
Fixes #376 Add a new profile in the Docker Compose file for building C++ source code with Jenkins. * **Docker Compose Files:** * Add a `cpp` profile in `docker-compose.yaml` and `build-docker-compose.yaml`. * Include necessary service definitions, dependencies, healthcheck, and volume configurations. * **Dockerfile:** * Create `dockerfiles/cpp/Dockerfile` with necessary C++ build tools including `build-essential`, `cmake`, `gcc`, `g++`, `clang`, `make`, `libstdc++-dev`, and `pkg-config`. * Set environment variables and ensure ownership of the Jenkins agent home directory. * **Updatecli Manifest:** * Add `updatecli/updatecli.d/cpp.yaml` for managing the C++ Dockerfile. * Ensure the manifest includes the necessary dependencies for the C++ build environment. * **GitHub Actions:** * Modify `.github/workflows/github-docker-registry-push.yml` to add a new job for building and pushing the C++ Docker image to ghcr. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/gounthar/quickstart-tutorials/issues/376?shareId=XXXX-XXXX-XXXX-XXXX).
WalkthroughThis pull request introduces a new Jenkins C++ agent by extending the CI/CD pipeline. A GitHub Actions workflow now conditionally builds and pushes a Docker image for the C++ tutorial. Additionally, two Docker Compose files gain a new service configuration for the C++ agent, a Dockerfile is added for building the C++ environment, and an updatecli target updates the Docker image tag. Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant GH as GitHub Repository
participant GA as GitHub Actions Workflow
participant DBA as Docker Build & Push Action
participant GCR as GitHub Container Registry
Dev->>GH: Push code changes
GH->>GA: Trigger workflow
GA->>GA: Check if `dockerfiles/cpp/Dockerfile` is modified
alt Dockerfile modified
GA->>DBA: Build image for C++ agent (linux/amd64, linux/aarch64)
DBA->>GCR: Push built image with tag format
else Dockerfile not modified
GA-->>GA: Skip C++ build step
end
sequenceDiagram
participant DC as Docker Compose
participant SS as sidekick_service
participant JC as jenkins_controller
participant CPP as cpp Service
participant HC as Healthcheck
DC->>SS: Start sidekick_service
SS-->>DC: Service completed successfully
DC->>JC: Start jenkins_controller
JC-->>DC: Service started
DC->>CPP: Initiate cpp service with volume mount
CPP->>HC: Run healthcheck every 5s
HC-->>CPP: Validate `/home/jenkins/.ssh/authorized_keys`
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. 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: 0
🧹 Nitpick comments (1)
updatecli/updatecli.d/cpp.yaml (1)
1-43
: Updatecli Manifest for C++ Build EnvironmentThe Updatecli manifest is well structured. It correctly defines a GitHub SCM block with dynamic placeholders and sets up a shell source that returns the required list of packages. The target configuration properly identifies the Dockerfile (
dockerfiles/cpp/Dockerfile
) and the apt-get install instruction to update. The action to create a pull request is clearly laid out.One suggestion: Ensure that the package list echoed in the source exactly matches the apt-get command in the Dockerfile so that dependency updates remain consistent.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.github/workflows/github-docker-registry-push.yml
(1 hunks)build-docker-compose.yaml
(1 hunks)docker-compose.yaml
(1 hunks)dockerfiles/cpp/Dockerfile
(1 hunks)updatecli/updatecli.d/cpp.yaml
(1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Anchore Grype vulnerability scan
dockerfiles/cpp/Dockerfile
[error] 31-31: Plugin prerequisite not met: Plugin configuration-as-code:1932.v75cb_b_f1b_698d (via prism-api:1.29.0-19) depends on plugin-util-api:6.0.0, but there is an older version defined on the top level - plugin-util-api:5.1.0.
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Codacy Security Scan
🔇 Additional comments (4)
dockerfiles/cpp/Dockerfile (1)
1-20
: Review of the new C++ DockerfileThe Dockerfile is clear and straightforward. It builds on the
jenkins/ssh-agent:6.9.0
base image and installs all the necessary C++ build tools usingapt-get install -y --no-install-recommends
. The cleanup command (rm -rf /var/lib/apt/lists/*
) helps reduce the image size. Setting thePATH
environment variable and adjusting ownership of the Jenkins agent home directory are implemented correctly.However, note the pipeline failure message regarding a plugin prerequisite (plugin-util-api version mismatch). While this message does not directly impact the Dockerfile’s instructions, please verify the top-level plugin versions in your Jenkins configuration to ensure all dependencies (e.g., plugin-util-api) meet the required versions.
build-docker-compose.yaml (1)
208-224
: New C++ Service in Build Docker ComposeThe addition of the
cpp
service is implemented consistently with the other agent services. The build context (dockerfiles/cpp/.
), container naming (desktop-jenkins_agent-1-cpp
), and profile configuration (cpp
) follow the established patterns. The dependencies onsidekick_service
andjenkins_controller
, along with the healthcheck (ensuring/home/jenkins/.ssh/authorized_keys
exists), are set correctly. This integration should provide a robust C++ build environment for your CI/CD chain.Please verify during integration testing that this service interacts correctly with the rest of the services.
.github/workflows/github-docker-registry-push.yml (1)
208-217
: GitHub Actions Job for C++ Jenkins AgentThe new job step “Build and push the jenkins agent for cpp tutorial” is added appropriately. The conditional check using
if: contains(env.files, 'dockerfiles/cpp/Dockerfile')
ensures that the step runs only when the C++ Dockerfile has been modified. The build context (./dockerfiles/cpp
), platform specifications (linux/amd64, linux/aarch64
), and tagging format with${{ env.BRANCH }}
are consistent with your other job steps.Everything appears to be correctly configured.
docker-compose.yaml (1)
284-300
: Configuration of the C++ Service in Docker ComposeThe newly added
cpp
service indocker-compose.yaml
mirrors the configuration found inbuild-docker-compose.yaml
. It uses environment variables to determine the Docker image, sets the container name todesktop-jenkins_agent-1-cpp
, and associates the service with thecpp
profile. Dependencies on bothsidekick_service
andjenkins_controller
are appropriately declared, and the healthcheck confirms the presence of the/home/jenkins/.ssh/authorized_keys
file. The volume mapping foragent-ssh-dir
as read-only is consistent with other agent services.The configuration is well integrated and consistent with the overall setup.
dockerfiles/cpp/Dockerfile
Outdated
FROM jenkins/ssh-agent:6.9.0 | ||
|
||
# Install necessary C++ build tools | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ |
Check notice
Code scanning / Hadolint (reported by Codacy)
Pin versions in apt get install. Instead of apt-get install <package> use apt-get install <package>=<version> Note
extract-profiles.sh
Outdated
# Check if the service has dependencies | ||
if yq e ".services.${service}.depends_on" "$original_file" -e > /dev/null; then | ||
# Read dependencies of the service | ||
local dependencies=($(yq e ".services.${service}.depends_on | keys" "$original_file" -o json | jq -r '.[]')) |
Check notice
Code scanning / Shellcheck (reported by Codacy)
Prefer mapfile or read -a to split command output (or quote to avoid splitting). Note
extract-profiles.sh
Outdated
declare -A all_dependencies | ||
services=$(yq e '.services | keys' "$original_file" -o json | jq -r '.[]') | ||
for service in $services; do | ||
dependencies=$(yq e ".services.$service.depends_on | keys" "$original_file" -o json | jq -r '.[]') |
Check notice
Code scanning / Shellcheck (reported by Codacy)
Variable was used as an array but is now assigned a string. Note
extract-profiles.sh
Outdated
services=$(yq e '.services | keys' "$original_file" -o json | jq -r '.[]') | ||
for service in $services; do | ||
dependencies=$(yq e ".services.$service.depends_on | keys" "$original_file" -o json | jq -r '.[]') | ||
for dependency in $dependencies; do |
Check notice
Code scanning / Shellcheck (reported by Codacy)
Expanding an array without an index only gives the first element. Note
extract-profiles.sh
Outdated
for service in $services; do | ||
dependencies=$(yq e ".services.$service.depends_on | keys" "$original_file" -o json | jq -r '.[]') | ||
for dependency in $dependencies; do | ||
all_dependencies["$dependency"]=1 |
Check notice
Code scanning / Shellcheck (reported by Codacy)
all_dependencies appears unused. Verify use (or export if used externally). Note
extract-profiles.sh
Outdated
|
||
# Generate the docker-compose file for the profile | ||
echo "Generating docker-compose-$profile.yaml" | ||
yq e ".services | with_entries(select(.key as \$k | .key == \"$included_services_list\"))" "$original_file" > "docker-compose-$profile.yaml" |
Check notice
Code scanning / Shellcheck (reported by Codacy)
included_services_list is referenced but not assigned. Note
Fixes #376
Add a new profile in the Docker Compose file for building C++ source code with Jenkins.
cpp
profile indocker-compose.yaml
andbuild-docker-compose.yaml
.dockerfiles/cpp/Dockerfile
with necessary C++ build tools includingbuild-essential
,cmake
,gcc
,g++
,clang
,make
,libstdc++-dev
, andpkg-config
.updatecli/updatecli.d/cpp.yaml
for managing the C++ Dockerfile..github/workflows/github-docker-registry-push.yml
to add a new job for building and pushing the C++ Docker image to ghcr.For more details, open the Copilot Workspace session.
Summary by CodeRabbit