From 0597a2935fd572c58ddd1dc0ae385aca6e4ae437 Mon Sep 17 00:00:00 2001 From: brais <26645694+braisvq1996@users.noreply.github.com> Date: Tue, 12 Dec 2023 22:36:08 +0100 Subject: [PATCH] Remove nodejs12 (#977) --- .../continuous-integration-workflow.yml | 16 ---- CHANGELOG.md | 1 + Makefile | 14 +--- common/jenkins-agents/README.md | 10 +-- .../nodejs12/docker/Dockerfile.ubi8 | 78 ------------------- .../docker/contrib/bin/configure-agent | 63 --------------- .../nodejs12/docker/contrib/bin/scl_enable | 3 - .../nodejs12/docker/yum.repos.d/centos8.repo | 13 ---- .../docker/yum.repos.d/google-chrome.repo | 6 -- .../nodejs12/ocp-config/Tailorfile | 5 -- .../jenkins-agents/nodejs12/ocp-config/bc.yml | 66 ---------------- .../jenkins-agents/nodejs12/ocp-config/is.yml | 14 ---- .../pages/{nodejs12.adoc => nodejs20.adoc} | 8 +- docs/modules/quickstarters/nav.adoc | 2 +- 14 files changed, 14 insertions(+), 285 deletions(-) delete mode 100644 common/jenkins-agents/nodejs12/docker/Dockerfile.ubi8 delete mode 100644 common/jenkins-agents/nodejs12/docker/contrib/bin/configure-agent delete mode 100644 common/jenkins-agents/nodejs12/docker/contrib/bin/scl_enable delete mode 100644 common/jenkins-agents/nodejs12/docker/yum.repos.d/centos8.repo delete mode 100644 common/jenkins-agents/nodejs12/docker/yum.repos.d/google-chrome.repo delete mode 100644 common/jenkins-agents/nodejs12/ocp-config/Tailorfile delete mode 100644 common/jenkins-agents/nodejs12/ocp-config/bc.yml delete mode 100644 common/jenkins-agents/nodejs12/ocp-config/is.yml rename docs/modules/jenkins-agents/pages/{nodejs12.adoc => nodejs20.adoc} (50%) diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml index 078ff7761..c48c6ab38 100644 --- a/.github/workflows/continuous-integration-workflow.yml +++ b/.github/workflows/continuous-integration-workflow.yml @@ -34,22 +34,6 @@ jobs: --build-arg nexusPassword=s3cr3t \ . - jenkins-agent-nodejs12-ubi8: - name: Jenkins agent NodeJS 12 (UBI8) - runs-on: ubuntu-22.04 - steps: - - - name: Checkout repository - uses: actions/checkout@v4.1.1 - - - name: Build docker image - working-directory: common/jenkins-agents/nodejs12/docker - run: | - docker build --tag agent-nodejs12-test-ubi8 --file Dockerfile.ubi8 \ - --build-arg nexusUrl=https://nexus.example.com \ - --build-arg nexusAuth=developer:s3cr3t \ - . - jenkins-agent-nodejs16-ubi8: name: Jenkins agent NodeJS 16 (UBI8) runs-on: ubuntu-22.04 diff --git a/CHANGELOG.md b/CHANGELOG.md index ecf27971f..cab0c8f6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Update Streamlit and Python quickstarters and agent ([#968](https://github.com/opendevstack/ods-quickstarters/issues/968)) ### Modified +- Remove nodejs12 form the code ([#936](https://github.com/opendevstack/ods-quickstarters/issues/936)) ### Fixed - Maintenance for Golang Agent and QuickStarter ([#955](https://github.com/opendevstack/ods-quickstarters/issues/955)) diff --git a/Makefile b/Makefile index f8cc8d4b4..c3b96b632 100644 --- a/Makefile +++ b/Makefile @@ -12,11 +12,11 @@ install-jenkins-agent: install-jenkins-agent-golang install-jenkins-agent-jdk in .PHONY: install-jenkins-agent ## Update OpenShift resources related Jenkins agent resources. -apply-jenkins-agent-build: apply-jenkins-agent-golang-build apply-jenkins-agent-jdk-build apply-jenkins-agent-nodejs12-build apply-jenkins-agent-nodejs16-build apply-jenkins-agent-nodejs18-build apply-jenkins-agent-nodejs20-build apply-jenkins-agent-python-build apply-jenkins-agent-scala-build apply-jenkins-agent-terraform-build +apply-jenkins-agent-build: apply-jenkins-agent-golang-build apply-jenkins-agent-jdk-build apply-jenkins-agent-nodejs16-build apply-jenkins-agent-nodejs18-build apply-jenkins-agent-nodejs20-build apply-jenkins-agent-python-build apply-jenkins-agent-scala-build apply-jenkins-agent-terraform-build .PHONY: apply-jenkins-agent-build ## Start builds of Jenkins agents. -start-jenkins-agent-build: start-jenkins-agent-golang-build start-jenkins-agent-jdk-build start-jenkins-agent-nodejs12-build start-jenkins-agent-nodejs16-build start-jenkins-agent-nodejs18-build start-jenkins-agent-nodejs20-build start-jenkins-agent-python-build start-jenkins-agent-scala-build start-jenkins-agent-terraform-build +start-jenkins-agent-build: start-jenkins-agent-golang-build start-jenkins-agent-jdk-build start-jenkins-agent-nodejs16-build start-jenkins-agent-nodejs18-build start-jenkins-agent-nodejs20-build start-jenkins-agent-python-build start-jenkins-agent-scala-build start-jenkins-agent-terraform-build .PHONY: start-jenkins-agent-build @@ -54,14 +54,10 @@ start-jenkins-agent-jdk-build: # JENKINS AGENT NODEJS ## Install or update Jenkins Node agent resources. -install-jenkins-agent-nodejs: apply-jenkins-agent-nodejs12-build apply-jenkins-agent-nodejs16-build apply-jenkins-agent-nodejs18-build apply-jenkins-agent-nodejs20-build start-jenkins-agent-nodejs12-build start-jenkins-agent-nodejs16-build start-jenkins-agent-nodejs18-build start-jenkins-agent-nodejs20-build +install-jenkins-agent-nodejs: apply-jenkins-agent-nodejs16-build apply-jenkins-agent-nodejs18-build apply-jenkins-agent-nodejs20-build start-jenkins-agent-nodejs16-build start-jenkins-agent-nodejs18-build start-jenkins-agent-nodejs20-build .PHONY: install-jenkins-agent-nodejs ## Update OpenShift resources related to Jenkins Node agent image. -apply-jenkins-agent-nodejs12-build: - cd common/jenkins-agents/nodejs12/ocp-config && tailor apply --namespace $(ODS_NAMESPACE) -.PHONY: apply-jenkins-agent-nodejs12-build - apply-jenkins-agent-nodejs16-build: cd common/jenkins-agents/nodejs16/ocp-config && tailor apply --namespace $(ODS_NAMESPACE) .PHONY: apply-jenkins-agent-nodejs16-build @@ -75,10 +71,6 @@ apply-jenkins-agent-nodejs20-build: .PHONY: apply-jenkins-agent-nodejs20-build ## Start build of BuildConfig "jenkins-agent-nodejs*". -start-jenkins-agent-nodejs12-build: - oc -n $(ODS_NAMESPACE) start-build jenkins-agent-nodejs12 --follow -.PHONY: start-jenkins-agent-nodejs12-build - start-jenkins-agent-nodejs16-build: oc -n $(ODS_NAMESPACE) start-build jenkins-agent-nodejs16 --follow .PHONY: start-jenkins-agent-nodejs16-build diff --git a/common/jenkins-agents/README.md b/common/jenkins-agents/README.md index 7f5b67abe..f331f06d9 100644 --- a/common/jenkins-agents/README.md +++ b/common/jenkins-agents/README.md @@ -17,12 +17,12 @@ The ODS [jenkins shared library](https://github.com/opendevstack/ods-jenkins-sha 1. [GoLang](golang) 2. [Jdk](jdk) -3. [Node.js 12](nodejs12) -4. [Node.js 16](nodejs16) +3. [Node.js 16](nodejs16) 4. [Node.js 18](nodejs18) -5. [Python](python) -6. [Scala & SBT](scala) -7. [Terraform](terraform) +5. [Node.js 20](nodejs20) +6. [Python](python) +7. [Scala & SBT](scala) +8. [Terraform](terraform) ## OCP Config / Installation diff --git a/common/jenkins-agents/nodejs12/docker/Dockerfile.ubi8 b/common/jenkins-agents/nodejs12/docker/Dockerfile.ubi8 deleted file mode 100644 index 76c74f53b..000000000 --- a/common/jenkins-agents/nodejs12/docker/Dockerfile.ubi8 +++ /dev/null @@ -1,78 +0,0 @@ -FROM opendevstackorg/ods-jenkins-agent-base-ubi8:latest - -# Labels consumed by Red Hat build service -LABEL com.redhat.component="jenkins-agent-nodejs-12-rhel7-container" \ - name="openshift4/jenkins-agent-nodejs-12-rhel7" \ - architecture="x86_64" \ - io.k8s.display-name="Jenkins Agent Nodejs" \ - io.k8s.description="The jenkins agent nodejs image has the nodejs tools on top of the jenkins agent base image." \ - io.openshift.tags="openshift,jenkins,agent,nodejs" \ - maintainer="openshift-dev-services+jenkins@redhat.com" - -ARG nexusUrl -ARG nexusAuth - -ENV NODEJS_VERSION=12 \ - YARN_VERSION=1.22.5 \ - NPM_CONFIG_PREFIX=$HOME/.npm-global \ - PATH=$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \ - LANG=en_US.UTF-8 \ - LC_ALL=en_US.UTF-8 - -ENV INSTALL_PKGS="make gcc-c++ GConf2 nss libXScrnSaver alsa-lib " -ENV INSTALL_CENTOS_PKGS="nodejs nodejs-nodemon xorg-x11-server-Xvfb gtk2-devel gtk3-devel libnotify-devel" - -# Workaroud we use when running behind proxy -# Basically we put the proxy certificate in certs folder -# COPY certs/* /etc/pki/ca-trust/source/anchors/ -# RUN update-ca-trust force-enable && update-ca-trust extract - -COPY contrib/bin/configure-agent /usr/local/bin/configure-agent - -COPY yum.repos.d/*.repo /etc/yum.repos.d/ -RUN sed -i 's@^\s*enabled\s*=.*$@enabled = 1@g' /etc/yum.repos.d/*.repo \ - && sed -i 's@^\s*enabled\s*=.*$@enabled = 0@g' /etc/yum.repos.d/centos*.repo \ - && sed -i 's@^\s*enabled\s*=.*$@enabled = 0@g' /etc/yum.repos.d/google-chrome*.repo \ - && grep -i '\(name\|enabled\)' /etc/yum.repos.d/*.repo - -# Install Python 3 (because node-gyp, an ionic dependency, uses it) and set it as default -RUN yum install -y python3 python3-pip || true -# update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \ -RUN bash -c "python -V 2>&1 | grep -q 'Python 3.*' || update-alternatives --install /usr/bin/python python /usr/bin/python3 1 " && \ - bash -c "python -V 2>&1 | grep 'Python 3.*' || echo 'ERROR: Invalid python version'" - -# Generate machine ID -RUN dbus-uuidgen > /etc/machine-id - -# Install NodeJS (https://rpm.nodesource.com/setup_12.x does NOT work) -RUN yum install -y $INSTALL_PKGS && \ - yum module enable -y nodejs:${NODEJS_VERSION} && \ - yum install -y --setopt=tsflags=nodocs --disableplugin=subscription-manager --enablerepo centos-appstream --enablerepo centos-baseos $INSTALL_CENTOS_PKGS && \ - rpm -V $INSTALL_PKGS - -# Install Yarn -# https://classic.yarnpkg.com/en/docs/install -RUN curl -o- -sSL https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION - -# Install Cypress dependencies -# https://docs.cypress.io/guides/getting-started/installing-cypress.html#System-requirements -RUN yum repolist \ - && yum install -y --enablerepo google-chrome --enablerepo centos-appstream --enablerepo centos-baseos google-chrome-stable \ - && yum clean all -y - -RUN npm config set registry=$nexusUrl/repository/npmjs/ && \ - npm config set always-auth=true && \ - npm config set _auth=$(echo -n $nexusAuth | base64) && \ - npm config set email=no-reply@opendevstack.org && \ - npm config set ca=null && \ - npm config set strict-ssl=false && \ - yarn config set registry $nexusUrl/repository/npmjs/ -g && \ - echo node version: $(node --version) && \ - echo npm version: $(npm --version) && \ - echo npx version: $(npx --version) && \ - echo yarn version: $(yarn --version) - -RUN chown -R 1001:0 $HOME && \ - chmod -R g+rwX $HOME - -USER 1001 diff --git a/common/jenkins-agents/nodejs12/docker/contrib/bin/configure-agent b/common/jenkins-agents/nodejs12/docker/contrib/bin/configure-agent deleted file mode 100644 index 02ab20288..000000000 --- a/common/jenkins-agents/nodejs12/docker/contrib/bin/configure-agent +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -# extract the different element of an url into a JSON structure -parse_url() { - # extract the protocol - proto="$(echo $1 | cut -f1 -d: )" - if [[ ! -z $proto ]] ; then - # remove the protocol - url="$(echo ${1/"$proto://"/})" - # extract the user (if any) - login="$(echo $url | grep @ | cut -d@ -f1)" - username="$(echo $login | cut -d: -f1)" - password="$(echo $login | cut -d: -f2)" - # extract the host - host_port="$(echo ${url/$login@/} | cut -d/ -f1) " - host="$(echo $host_port | cut -f1 -d:) " - - # by request - try to extract the port - port="$(echo $host_port | sed -e 's,^.*:,:,g' -e 's,.*:\([0-9]*\).*,\1,g' -e 's,[^0-9],,g')" - # extract the uri (if any) - resource="/$(echo $url | grep / | cut -d/ -f2-)" - fi - echo -n "{ \"uri\": \"$1\" , \"url\": \"$url\" , \"proto\": \"$proto\" , \"login\": \"$login\" ," - echo " \"username\": \"$username\" , \"password\": \"$password\" , \"host\": \"$host\" , \"port\": \"$port\" }" -} - -get_npm_proxy_config(){ - local proto json - proto=$1 - json=$2 - username=$( echo $json | jq -r .username) - password=$( echo $json | jq -r .password) - host=$( echo $json | jq -r .host) - port=$( echo $json | jq -r .port) - proxy_url="$host:$port" - - if [ -n "$username" -a -n "$password" ]; then - proxy_url="$proto://$username:$password@$proxy_url" - fi - - echo $proxy_url -} - - -if [ -n "$http_proxy" ]; then - json=$( parse_url $http_proxy ) - proxy=$(get_npm_proxy_config http "$json") - npm -g config set proxy $proxy -fi - -if [ -n "$https_proxy" ]; then - json=$( parse_url $https_proxy ) - proxy=$(get_npm_proxy_config https "$json") - npm -g config set https_proxy $proxy -fi - -if [ -n "$no_proxy" ]; then - npm -g config set noproxy $no_proxy -fi - -if [ -n "$NPM_MIRROR_URL" ]; then - npm -g config set registry "$NPM_MIRROR_URL" -fi diff --git a/common/jenkins-agents/nodejs12/docker/contrib/bin/scl_enable b/common/jenkins-agents/nodejs12/docker/contrib/bin/scl_enable deleted file mode 100644 index d2276ab84..000000000 --- a/common/jenkins-agents/nodejs12/docker/contrib/bin/scl_enable +++ /dev/null @@ -1,3 +0,0 @@ -# This will make scl collection binaries work out of box. -unset BASH_ENV PROMPT_COMMAND ENV -source scl_source enable rh-nodejs12 diff --git a/common/jenkins-agents/nodejs12/docker/yum.repos.d/centos8.repo b/common/jenkins-agents/nodejs12/docker/yum.repos.d/centos8.repo deleted file mode 100644 index c4d61f43b..000000000 --- a/common/jenkins-agents/nodejs12/docker/yum.repos.d/centos8.repo +++ /dev/null @@ -1,13 +0,0 @@ -[centos-baseos] -name=CentOS-8-BaseOS -baseurl=http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/ -enabled=1 -gpgcheck=1 -gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official - -[centos-appstream] -name=CentOS-8-AppStream -baseurl=http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/ -enabled=1 -gpgcheck=1 -gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official diff --git a/common/jenkins-agents/nodejs12/docker/yum.repos.d/google-chrome.repo b/common/jenkins-agents/nodejs12/docker/yum.repos.d/google-chrome.repo deleted file mode 100644 index 96e7eece3..000000000 --- a/common/jenkins-agents/nodejs12/docker/yum.repos.d/google-chrome.repo +++ /dev/null @@ -1,6 +0,0 @@ -[google-chrome] -name=google-chrome -baseurl=https://dl.google.com/linux/chrome/rpm/stable/$basearch -enabled=0 -gpgcheck=1 -gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub diff --git a/common/jenkins-agents/nodejs12/ocp-config/Tailorfile b/common/jenkins-agents/nodejs12/ocp-config/Tailorfile deleted file mode 100644 index df8c9844a..000000000 --- a/common/jenkins-agents/nodejs12/ocp-config/Tailorfile +++ /dev/null @@ -1,5 +0,0 @@ -namespace ods -selector app=jenkins-agent-nodejs12 -param-file ../../../../../ods-configuration/ods-core.env -ignore-unknown-parameters true -bc,is diff --git a/common/jenkins-agents/nodejs12/ocp-config/bc.yml b/common/jenkins-agents/nodejs12/ocp-config/bc.yml deleted file mode 100644 index c15f190d9..000000000 --- a/common/jenkins-agents/nodejs12/ocp-config/bc.yml +++ /dev/null @@ -1,66 +0,0 @@ -apiVersion: template.openshift.io/v1 -kind: Template -metadata: - name: jenkins-agent-nodejs12 -parameters: -- name: ODS_BITBUCKET_PROJECT - description: Bitbucket project name. - value: opendevstack -- name: NEXUS_URL - required: true -- name: NEXUS_AUTH - required: true -- name: REPO_BASE - required: true -- name: ODS_IMAGE_TAG - required: true - value: latest -- name: ODS_GIT_REF - required: true -- name: JENKINS_AGENT_DOCKERFILE_PATH - value: Dockerfile.ubi8 - description: Dockerfile variant to use -objects: -- apiVersion: v1 - kind: BuildConfig - metadata: - name: jenkins-agent-nodejs12 - labels: - app: jenkins-agent-nodejs12 - spec: - failedBuildsHistoryLimit: 5 - nodeSelector: null - output: - to: - kind: ImageStreamTag - name: jenkins-agent-nodejs12:${ODS_IMAGE_TAG} - postCommit: {} - resources: - limits: - cpu: "1" - memory: "2Gi" - requests: - cpu: "200m" - memory: "1Gi" - runPolicy: Serial - source: - contextDir: common/jenkins-agents/nodejs12/docker - git: - ref: ${ODS_GIT_REF} - uri: ${REPO_BASE}/${ODS_BITBUCKET_PROJECT}/ods-quickstarters.git - sourceSecret: - name: cd-user-token - type: Git - strategy: - dockerStrategy: - buildArgs: - - name: nexusUrl - value: ${NEXUS_URL} - - name: nexusAuth - value: ${NEXUS_AUTH} - dockerfilePath: ${JENKINS_AGENT_DOCKERFILE_PATH} - from: - kind: ImageStreamTag - name: jenkins-agent-base:${ODS_IMAGE_TAG} - type: Docker - successfulBuildsHistoryLimit: 5 diff --git a/common/jenkins-agents/nodejs12/ocp-config/is.yml b/common/jenkins-agents/nodejs12/ocp-config/is.yml deleted file mode 100644 index 2e5c6d636..000000000 --- a/common/jenkins-agents/nodejs12/ocp-config/is.yml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: template.openshift.io/v1 -kind: Template -metadata: - name: jenkins-agent-nodejs12 -objects: -- apiVersion: v1 - kind: ImageStream - metadata: - name: jenkins-agent-nodejs12 - labels: - app: jenkins-agent-nodejs12 - spec: - lookupPolicy: - local: false diff --git a/docs/modules/jenkins-agents/pages/nodejs12.adoc b/docs/modules/jenkins-agents/pages/nodejs20.adoc similarity index 50% rename from docs/modules/jenkins-agents/pages/nodejs12.adoc rename to docs/modules/jenkins-agents/pages/nodejs20.adoc index de286d3d1..bb8905e7d 100644 --- a/docs/modules/jenkins-agents/pages/nodejs12.adoc +++ b/docs/modules/jenkins-agents/pages/nodejs20.adoc @@ -1,12 +1,12 @@ -= Node.js 12 - Jenkins agent += Node.js 20 - Jenkins agent == Introduction This agent is used to build Node.js-based projects, through `npm` or `yarn`. -The image is built in the global `ods` project and is named `jenkins-agent-nodejs12`. -It can be referenced in a `Jenkinsfile` with `ods/jenkins-agent-nodejs12`. +The image is built in the global `ods` project and is named `jenkins-agent-nodejs20`. +It can be referenced in a `Jenkinsfile` with `ods/jenkins-agent-nodejs20`. -CAUTION: Node.js version 12 reaches end-of-life in 2022-04-30. It is not recommended to start a new project using this agent. Existing projects should be migrated to a newer version, e.g. xref:jenkins-agents:nodejs16.adoc[Node.js 16]. Next releases will remove support for version 12. +IMPORTANT: Node.js version 20 reaches end-of-life in 2026-04-30. Support for this version will be removed in releases after this date. Please consider switching to newer versions of this agent as soon as they are available. == Features 1. Nexus configuration diff --git a/docs/modules/quickstarters/nav.adoc b/docs/modules/quickstarters/nav.adoc index ca4754081..a544d694f 100644 --- a/docs/modules/quickstarters/nav.adoc +++ b/docs/modules/quickstarters/nav.adoc @@ -21,9 +21,9 @@ *** xref:jenkins-agents:golang.adoc[Go] *** xref:jenkins-agents:inf-terraform.adoc[terraform] *** xref:jenkins-agents:jdk.adoc[jdk] -*** xref:jenkins-agents:nodejs12.adoc[Node.js 12] *** xref:jenkins-agents:nodejs16.adoc[Node.js 16] *** xref:jenkins-agents:nodejs18.adoc[Node.js 18] +*** xref:jenkins-agents:nodejs20.adoc[Node.js 20] *** xref:jenkins-agents:python.adoc[Python] *** xref:jenkins-agents:scala.adoc[Scala] ** xref:quickstarters:authoring-quickstarters.adoc[Authoring Quickstarters]