Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ updates:
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: docker
directory: "./dockerfiles/dotnet"
schedule:
interval: weekly
open-pull-requests-limit: 10
6 changes: 6 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,9 @@ multi:
github_actions:
- changed-files:
- any-glob-to-any-file: '/.github/workflows/*'


# Add 'dotnet' label to any change to Dockerfile* files within the root dir
dotnet:
- changed-files:
- any-glob-to-any-file: 'dockerfiles/dotnet/**'
10 changes: 10 additions & 0 deletions .github/workflows/github-docker-registry-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,13 @@ jobs:
platforms: linux/amd64, linux/aarch64
push: true
tags: ghcr.io/${{ env.REPO_NAME }}/jenkinsci-tutorials:cpp_${{ env.BRANCH }}

- name: Build and push the jenkins agent for dotnet tutorial
# This step builds and pushes the Jenkins agent for the C++ tutorial
if: contains(env.files, 'dockerfiles/dotnet/Dockerfile')
uses: docker/build-push-action@v6
with:
context: ./dockerfiles/dotnet
platforms: linux/amd64, linux/aarch64
push: true
tags: ghcr.io/${{ env.REPO_NAME }}/jenkinsci-tutorials:dotnet_${{ env.BRANCH }}
20 changes: 20 additions & 0 deletions build-docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ services:
- android
- multi
- golang
- dotnet
- default
# This service depends on the sidekick_service (generating SSH keys and JCasc token) completing successfully.
depends_on:
Expand Down Expand Up @@ -222,6 +223,25 @@ services:
retries: 5
volumes:
- agent-ssh-dir:/home/jenkins/.ssh:ro
dotnet:
build: dockerfiles/dotnet/.
container_name: desktop-jenkins_agent-1-dotnet
profiles:
- dotnet
depends_on:
sidekick_service:
condition: service_completed_successfully
jenkins_controller:
condition: service_started
ports:
- "5000:5000"
healthcheck:
test: ["CMD-SHELL", "[ -f /home/jenkins/.ssh/authorized_keys ] || exit 1"]
interval: 5s
timeout: 10s
retries: 5
volumes:
- agent-ssh-dir:/home/jenkins/.ssh:ro
volumes:
jenkins_home: null
agent-ssh-dir:
Expand Down
25 changes: 24 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ services:
- android
- multi
- golang
- dotnet
- default
# This service depends on the sidekick_service (generating SSH keys and JCasc token) completing successfully.
depends_on:
Expand All @@ -61,6 +62,7 @@ services:
- android
- golang
- cpp
- dotnet
- default
# The CASC_RELOAD_TOKEN environment variable is used by the Jenkins controller to restart the Configuration as Code (JCasc) plugin configuration.
environment:
Expand Down Expand Up @@ -304,7 +306,28 @@ services:
retries: 5
volumes:
- agent-ssh-dir:/home/jenkins/.ssh:ro # Mounts the agent-ssh-dir volume to the /home/jenkins/.ssh path inside the container as read-only

dotnet:
image: ${IMAGE_PREFIX}/${GHCR_USERNAME}/quickstart-tutorials/jenkinsci-tutorials:dotnet_${BRANCH_SUFFIX}
environment:
- GITPOD_WORKSPACE_URL=${GITPOD_WORKSPACE_URL}
container_name: desktop-jenkins_agent-1
profiles:
- dotnet
depends_on:
sidekick_service:
condition: service_completed_successfully # Depends on the successful completion of the sidekick_service
jenkins_controller:
condition: service_started
ports:
- "5000:5000"
healthcheck:
test: ["CMD-SHELL", "[ -f /home/jenkins/.ssh/authorized_keys ] || exit 1"]
# Checks if the authorized_keys file exists in the /home/jenkins/.ssh path
interval: 5s
timeout: 10s
retries: 5
volumes:
- agent-ssh-dir:/home/jenkins/.ssh:ro # Mounts the agent-ssh-dir volume to the /home/jenkins/.ssh path inside the container as read-only
volumes:
jenkins_home: null
empty_jenkins_home: null
Expand Down
22 changes: 22 additions & 0 deletions dockerfiles/dotnet/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM jenkins/ssh-agent:6.10.0 AS ssh-agent

# install dotnet dependencies
RUN apt-get update && apt-get install -y --no-install-recommends libc6 libgcc1 libgssapi-krb5-2 libicu72 libssl3 libstdc++6 zlib1g wget && apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Now time to install dotnet
ARG DOTNET_VERSION=8.0

# Set SHELL flags for RUN commands to allow -e and pipefail
# Rationale:https://github.com/hadolint/hadolint/wiki/DL4006
SHELL ["/bin/bash", "-eo", "pipefail", "-c"]

RUN wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh && chmod +x ./dotnet-install.sh && \
./dotnet-install.sh --channel ${DOTNET_VERSION} --install-dir /usr/local/dotnet

ENV DOTNET_ROOT=/usr/local/dotnet
ENV PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools

RUN echo "PATH=${PATH}" >> /etc/environment && chown -R jenkins:jenkins "${JENKINS_AGENT_HOME}" && \
dotnet --list-sdks

1 change: 1 addition & 0 deletions dockerfiles/plugins.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cloudbees-folder:6.985.va_f1635030cc5
commons-lang3-api:3.17.0-84.vb_b_938040b_078
commons-text-api:1.13.0-153.v91dcd89e2a_22
configuration-as-code:1932.v75cb_b_f1b_698d
coverage:2.2.0
credentials-binding:687.v619cb_15e923f
credentials:1408.va_622a_b_f5b_1b_1
display-url-api:2.209.v582ed814ff2f
Expand Down
Loading