diff --git a/.gitpod.yml b/.gitpod.yml deleted file mode 100644 index ecd20374..00000000 --- a/.gitpod.yml +++ /dev/null @@ -1,26 +0,0 @@ -# This .gitpod.yml file is used to configure the Gitpod workspace. - -# The 'image' field specifies the Docker image to be used for the workspace. -# The 'file' field under 'image' points to the Dockerfile that is used to build the Docker image. -image: - file: .gitpod/Dockerfile - -# The 'tasks' field specifies a list of commands that are run when the workspace is initialized. -# The 'init' field under 'tasks' specifies the command to be run before the main command. -# In this case, it downloads and installs 'yq', a command-line YAML processor, and runs several shell scripts. -tasks: - - init: sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 && sudo chmod a+x /usr/local/bin/yq && chmod +x ./dockerfiles/gitpodURL.sh && ./dockerfiles/gitpodURL.sh - -# The 'ports' field specifies a list of ports that should be exposed in the workspace. -# Each item in the list can have a 'name', 'port', 'protocol', 'onOpen', and 'description'. -# 'name' is a human-readable name for the port. -# 'port' is the port number. -# 'protocol' is the protocol used (e.g., 'http', 'https'). -# 'onOpen' specifies what should happen when the port is opened (e.g., 'open-preview', 'open-browser'). -# 'description' provides additional information about the port. -ports: - - name: Jenkins controller - port: 8080 - protocol: http - onOpen: open-preview - description: The Jenkins Controller to use for the tutorials \ No newline at end of file diff --git a/.gitpod/Dockerfile b/.gitpod/Dockerfile deleted file mode 100644 index 99fabf89..00000000 --- a/.gitpod/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# This Dockerfile is used to create a Gitpod workspace with GitHub CLI installed. - -# We start from the Gitpod full workspace image which includes a broad range of development tools. -FROM gitpod/workspace-full:2024-07-14-17-19-51 - -# The RUN command executes a series of commands in the new layer of the image and commits the results. -# The following commands are executed: - -# 1. Check if curl is installed. If not, update the package list and install curl. -# 2. Download the GPG key for the GitHub CLI repository and save it to a specific location. -# 3. Change the permissions of the GPG key file to make it readable for all users. -# 4. Add the GitHub CLI repository to the list of APT sources. -# 5. Update the package list again to include packages from the newly added repository. -# 6. Install the GitHub CLI (gh). -# 7. Clean up the APT cache to reduce the size of the image. -# 8. Remove unnecessary files and directories to further reduce the size of the image. -RUN type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y) && \ - curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg && \ - sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg && \ - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null && \ - sudo apt update && \ - sudo apt install gh -y && \ - sudo apt-get clean && \ - sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* diff --git a/README.md b/README.md index 71a9ad22..249ad46b 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,6 @@ This repository includes the files necessary for transitioning from `docker` to `docker compose` in our Jenkins tutorials and installation guides. -### How to Set Up the Repository in Gitpod? - -- To initialize your Gitpod workspace, prepend `gitpod.io/#` to any GitHub, GitLab, or Bitbucket repository URL. -- Access our Gitpod workspace [here](https://gitpod.io/#https://github.com/jenkins-docs/quickstart-tutorials). -- If you plan to use Gitpod regularly, we recommend installing the Gitpod extension. This extension adds a Gitpod button to every GitHub repository you visit, making it easy to launch a workspace. You can find the extension [here](https://chrome.google.com/webstore/detail/gitpod-online-ide/dodmmooeoklaejobgleioelladacbeki) for Chromium and [here](https://addons.mozilla.org/firefox/addon/gitpod/) for Firefox. - -## Gitpod - -Gitpod is a cloud-based development environment designed for teams. It supports various IDEs, including VScode, IntelliJ, and many more, enabling efficient and secure software development. - ### Steps to Run Examples from the Repository - Use `docker compose up` to run examples from this project. Currently, we have four working examples: @@ -35,7 +25,6 @@ Gitpod is a cloud-based development environment designed for teams. It supports - Check the status of the container with the `docker ps` or `docker compose ps` commands. - Access your running Jenkins instance at [http://127.0.0.1:8080](http://127.0.0.1:8080). -- On Gitpod, if containers are running successfully after entering `docker compose --profile up`, a pop-up titled `A service is available on port 8080` should appear. If it doesn't, you can view the running service in the `PORTS` section on the right side of the terminal. ### Clean Up Instructions @@ -43,18 +32,6 @@ Gitpod is a cloud-based development environment designed for teams. It supports - If you encounter a `Resource is still in use` warning, use the `--remove-orphans` option which would give `docker compose --profile down --remove-orphans`. - To remove the created volumes (should you need to restart from scratch), add the `-v` option which would give `docker compose --profile down -v`. -### Suppressing Jenkins Warning using JCASC - -To improve the Gitpod experience with Jenkins, we've suppressed a reverse proxy setup warning in Jenkins that was causing issues in the Gitpod environment. We achieved this using Jenkins Configuration as Code ([JCASC](https://www.jenkins.io/projects/jcasc/)) and added the following property to the JCASC YAML file: - -```yaml -jenkins: - disabledAdministrativeMonitors: - - "hudson.diagnosis.ReverseProxySetupMonitor" -``` - -For more detailed information about this configuration and the context behind it, please refer to the [corresponding issue](https://github.com/ash-sxn/GSoC-2023-docker-based-quickstart/issues/61). - ### Encountering Issues? If you encounter any issues while running the examples, please open an issue [in this repository](https://github.com/jenkins-docs/quickstart-tutorials/issues/new/choose). diff --git a/build-docker-compose.yaml b/build-docker-compose.yaml index 3c61325f..2e2eee3d 100644 --- a/build-docker-compose.yaml +++ b/build-docker-compose.yaml @@ -117,8 +117,6 @@ services: - 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 node: build: dockerfiles/node/. - environment: - - GITPOD_WORKSPACE_URL=${GITPOD_WORKSPACE_URL} container_name: desktop-jenkins_agent-1-node profiles: - node @@ -139,8 +137,6 @@ services: - 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 multi: build: dockerfiles/multi/. - environment: - - GITPOD_WORKSPACE_URL=${GITPOD_WORKSPACE_URL} container_name: desktop-jenkins_agent-1-multi profiles: - multi @@ -162,8 +158,6 @@ services: - 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 android: build: dockerfiles/android/. - environment: - - GITPOD_WORKSPACE_URL=${GITPOD_WORKSPACE_URL} container_name: desktop-jenkins_agent-1-android profiles: - android @@ -185,8 +179,6 @@ services: - 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 golang: build: dockerfiles/golang/. - environment: - - GITPOD_WORKSPACE_URL=${GITPOD_WORKSPACE_URL} container_name: desktop-jenkins_agent-1-golang profiles: - golang diff --git a/docker-compose.yaml b/docker-compose.yaml index 643cdccf..d7517163 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -176,8 +176,6 @@ services: - 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 node: image: ${IMAGE_PREFIX}/${GHCR_USERNAME}/quickstart-tutorials/jenkinsci-tutorials:node_agent_${BRANCH_SUFFIX} - environment: - - GITPOD_WORKSPACE_URL=${GITPOD_WORKSPACE_URL} container_name: desktop-jenkins_agent-1-node profiles: - node @@ -198,8 +196,6 @@ services: - 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 android: image: ${IMAGE_PREFIX}/${GHCR_USERNAME}/quickstart-tutorials/jenkinsci-tutorials:android_agent_${BRANCH_SUFFIX} - environment: - - GITPOD_WORKSPACE_URL=${GITPOD_WORKSPACE_URL} container_name: desktop-jenkins_agent-1-android profiles: - android @@ -239,8 +235,6 @@ services: retries: 5 multi: image: ${IMAGE_PREFIX}/${GHCR_USERNAME}/quickstart-tutorials/jenkinsci-tutorials:node_agent_${BRANCH_SUFFIX} - environment: - - GITPOD_WORKSPACE_URL=${GITPOD_WORKSPACE_URL} container_name: desktop-jenkins_agent-1-multi profiles: - multi @@ -262,8 +256,6 @@ services: - 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 golang: image: ${IMAGE_PREFIX}/${GHCR_USERNAME}/quickstart-tutorials/jenkinsci-tutorials:golang_${BRANCH_SUFFIX} - environment: - - GITPOD_WORKSPACE_URL=${GITPOD_WORKSPACE_URL} container_name: desktop-jenkins_agent-1-golang profiles: - golang diff --git a/dockerfiles/Dockerfile b/dockerfiles/Dockerfile index adac89f9..a0d40980 100644 --- a/dockerfiles/Dockerfile +++ b/dockerfiles/Dockerfile @@ -1,7 +1,7 @@ # This Dockerfile is used to create a Jenkins server with a specific version and pre-configured settings. # We start by defining an ARG for the Jenkins version. This allows us to easily change the version of Jenkins we want to use. -ARG JENKINS_VERSION=2.452.3 +ARG JENKINS_VERSION=2.447 # We then use the official Jenkins image with the specified version as our base image. FROM jenkins/jenkins:"${JENKINS_VERSION}" diff --git a/dockerfiles/gitpodURL.sh b/dockerfiles/gitpodURL.sh deleted file mode 100755 index ce668ed5..00000000 --- a/dockerfiles/gitpodURL.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# Set the path to the configuration file -config_file="/workspace/quickstart-tutorials/dockerfiles/jenkins.yaml" - -# Extract the hostname from the GITPOD_WORKSPACE_URL variable -service_url=$(echo "$GITPOD_WORKSPACE_URL" | awk -F/ '{print $3}') - -# Define an array of targets -targets=("maven" "node" "python" "multi" "default") - -# Initialize an empty string for the message -message="As a gentle reminder, the current profiles are: " - -# Loop over the targets array -for target in "${targets[@]}"; do - # Append to the message string - message+="\033[36m$target\033[0m, " -done - -# Remove the trailing comma and space -message=${message%??} - -# Print the hostname for debugging purposes -echo -e "Once you enter \033[42;30mdocker compose --profile _profile_ up\033[0m, Jenkins will be accessible here: \033[36mhttps://8080-$service_url\033[0m" -# Print the message -echo -e "$message" -# Loop over the targets array -for target in "${targets[@]}"; do - echo -e "To start the $target service, enter: \033[42;30mdocker compose --profile $target up\033[0m" -done - -# Use yq to update the value of the .unclassified.location.url field in the configuration file -yq eval ".unclassified.location.url = \"https://8080-$service_url/\"" "$config_file" > "$config_file.tmp" && mv "$config_file.tmp" "$config_file" - -# Use yq to add a line to suppress the Reverse Proxy setup is broken warning -yq e -i ".jenkins.disabledAdministrativeMonitors = [\"hudson.diagnosis.ReverseProxySetupMonitor\"]" $config_file diff --git a/updatecli/updatecli.d/gitpod.yaml b/updatecli/updatecli.d/gitpod.yaml deleted file mode 100644 index 4c728c1b..00000000 --- a/updatecli/updatecli.d/gitpod.yaml +++ /dev/null @@ -1,44 +0,0 @@ ---- -name: 'deps(dockerfile): bump image "gitpod/workspace-full" digest' - -scms: - default: - kind: github - spec: - user: "{{ .github.user }}" - email: "{{ .github.email }}" - owner: "{{ .github.owner }}" - repository: "{{ .github.repository }}" - token: "{{ requiredEnv .github.token }}" - username: "{{ .github.username }}" - branch: "{{ .github.branch }}" - -sources: - gitpod/workspace-full: - name: get latest image "gitpod/workspace-full" - kind: dockerimage - spec: - image: gitpod/workspace-full - tagfilter: '\d{4}-\d{2}-\d{2}-\d{2}-\d{2}-\d{2}' - -targets: - gitpod/workspace-full: - name: 'deps(dockerfile): bump image "gitpod/workspace-full"' - scmid: default - kind: dockerfile - spec: - file: .gitpod/Dockerfile - instruction: - keyword: FROM - matcher: gitpod/workspace-full - sourceid: gitpod/workspace-full - -actions: - default: - kind: github/pullrequest - scmid: default - title: Bump Gitpod version to {{ source "gitpod/workspace-full" }} - spec: - labels: - - dependencies - - debian-bookworm \ No newline at end of file diff --git a/updatecli/updatecli.d/jenkins-lts.yaml b/updatecli/updatecli.d/jenkins-weekly.yaml similarity index 53% rename from updatecli/updatecli.d/jenkins-lts.yaml rename to updatecli/updatecli.d/jenkins-weekly.yaml index b5fb62e8..7e97b8ac 100644 --- a/updatecli/updatecli.d/jenkins-lts.yaml +++ b/updatecli/updatecli.d/jenkins-weekly.yaml @@ -1,5 +1,5 @@ --- -name: Bump Jenkins' LTS version in the controller Dockerfile +name: Bump Jenkins' Weekly version in the controller Dockerfile scms: default: @@ -14,35 +14,35 @@ scms: branch: "{{ .github.branch }}" sources: - JenkinsLatestLTS: - name: Get the latest Jenkins LTS version - kind: shell + JenkinsLatestWeekly: + name: Get the latest Jenkins Weekly version + kind: jenkins spec: - command: bash ./updatecli/scripts/jenkins-lts.sh 0 # source input value passed as argument + release: weekly conditions: - # Test that the latest LTS Jenkins version exists - jenkinsLatestLTSVersion: + # Test that the latest Weekly Jenkins version exists + jenkinsLatestWeeklyVersion: kind: jenkins - sourceid: JenkinsLatestLTS + sourceid: JenkinsLatestWeekly targets: - setJenkinsLatestLTS: + setJenkinsLatestWeekly: kind: dockerfile spec: file: dockerfiles/Dockerfile instruction: keyword: "ARG" matcher: "JENKINS_VERSION" - name: "[jenkins-controller] Bump Jenkins LTS version in dockerfiles/Dockerfile" - sourceid: JenkinsLatestLTS + name: "[jenkins-controller] Bump Jenkins Weekly version in dockerfiles/Dockerfile" + sourceid: JenkinsLatestWeekly scmid: default actions: default: kind: github/pullrequest scmid: default - title: Update Jenkins LTS versions to {{ source "JenkinsLatestLTS" }} in the controller Dockerfile + title: Update Jenkins Weekly versions to {{ source "JenkinsLatestWeekly" }} in the controller Dockerfile spec: labels: - dependencies