From a23fae369e4c397152d494bbfe17b55570f2a9bf Mon Sep 17 00:00:00 2001 From: Zach Hoffman Date: Wed, 8 May 2024 14:21:08 -0600 Subject: [PATCH] Update Traffic Portal v2 builder and CI to NodeJS 18 (#8005) * Use apache/traffic_portal_v2_builder:master to build Traffic Portal v2 * Update TPv2 in GitHub Actions to use nodejs 18 * Use RHEL_VERSION 8 * changelog entry --- .github/workflows/chromdriver-update.yml | 29 +++++++++++- .github/workflows/tpv2.yml | 18 ++++---- CHANGELOG.md | 1 + .../docker/build/Dockerfile-traffic_portal_v2 | 46 +++++++++++++++++++ .../docker/build/docker-compose-opt.yml | 4 +- 5 files changed, 86 insertions(+), 12 deletions(-) create mode 100644 infrastructure/docker/build/Dockerfile-traffic_portal_v2 diff --git a/.github/workflows/chromdriver-update.yml b/.github/workflows/chromdriver-update.yml index 36da097924..dc11045a62 100644 --- a/.github/workflows/chromdriver-update.yml +++ b/.github/workflows/chromdriver-update.yml @@ -27,7 +27,7 @@ env: PROJECTS: jobs: - chromedriver-updater: + chromedriver-updater-tp: runs-on: ubuntu-latest steps: - name: Checkout repo @@ -48,4 +48,29 @@ jobs: GIT_AUTHOR_NAME: asf-ci-trafficcontrol GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_GITHUB_TOKEN: ${{ secrets.ASFCI_TOKEN }} - PROJECTS: "traffic_portal/test/integration/,experimental/traffic-portal/" + PROJECTS: "traffic_portal/test/integration/" + + chromedriver-updater-tpv2: + runs-on: ubuntu-latest + needs: + - chromedriver-updater-tp + steps: + - name: Checkout repo + uses: actions/checkout@master + id: checkout + - name: Install Python 3.10 + uses: actions/setup-python@v2 + with: { python-version: '3.10' } # Must be quoted to include the trailing 0 + - name: Install Node 16 + uses: actions/setup-node@v3 + with: + node-version: 18.x + - name: Install updater Python module and dependencies + run: pip install .github/actions/chromedriver-updater + - name: Run chromedriver-updater + uses: ./.github/actions/chromedriver-updater + env: + GIT_AUTHOR_NAME: asf-ci-trafficcontrol + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_GITHUB_TOKEN: ${{ secrets.ASFCI_TOKEN }} + PROJECTS: "experimental/traffic-portal/" diff --git a/.github/workflows/tpv2.yml b/.github/workflows/tpv2.yml index 0145445956..3b35ff1aa2 100644 --- a/.github/workflows/tpv2.yml +++ b/.github/workflows/tpv2.yml @@ -19,6 +19,7 @@ name: Experimental Traffic Portal v2 env: # alpine:3.13 ALPINE_VERSION: sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930 + NODE_VERSION: 18 on: push: @@ -55,14 +56,14 @@ jobs: uses: actions/cache@v3 with: path: ./experimental/traffic-portal/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('./experimental/traffic-portal/package-lock.json') }} + key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('./experimental/traffic-portal/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - name: Node 18 uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: ${{ env.NODE_VERSION }}.x - name: NPM install if: steps.restore-npm-cache.cache-hit != 'true' @@ -87,14 +88,15 @@ jobs: uses: actions/cache@v3 with: path: ./experimental/traffic-portal/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('./experimental/traffic-portal/package-lock.json') }} + key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('./experimental/traffic-portal/package-lock.json') }} + restore-keys: | ${{ runner.os }}-node- - name: Node 18 uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: ${{ env.NODE_VERSION }}.x - name: NPM install if: steps.restore-npm-cache.cache-hit != 'true' @@ -119,14 +121,14 @@ jobs: uses: actions/cache@v3 with: path: ./experimental/traffic-portal/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('./experimental/traffic-portal/package-lock.json') }} + key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('./experimental/traffic-portal/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - name: Node 18 uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: ${{ env.NODE_VERSION }}.x - name: Install latest Chrome run: sudo apt-get update && sudo apt-get install google-chrome-stable @@ -194,7 +196,7 @@ jobs: uses: actions/cache@v3 with: path: ./experimental/traffic-portal/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('./experimental/traffic-portal/package-lock.json') }} + key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('./experimental/traffic-portal/package-lock.json') }} restore-keys: | ${{ runner.os }}-node-modules- - name: Initialize Traffic Ops Database @@ -282,7 +284,7 @@ jobs: uses: actions/cache@v2 with: path: ${{ github.workspace }}/.npm - key: ${{ runner.os }}-node-modules-${{ hashFiles('experimental/traffic-portal/**/package*.json') }}- + key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('./experimental/traffic-portal/package-lock.json') }} - name: Build RPM uses: ./.github/actions/build-rpms env: diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ac673fdff..9cd0807153 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - [#7979](https://github.com/apache/trafficcontrol/pull/7979) *Traffic Router*, *Traffic Monitor*, *Traffic Stats*: Store logs in /var/log - [#7999](https://github.com/apache/trafficcontrol/pull/7999) *Traffic Router*, *Traffic Monitor*, *Traffic Stats*: Symlink from /opt//var/log to /var/log/. These symlinks are deprecated with the intent of removing them in ATC 9.0.0. - [#7872](https://github.com/apache/trafficcontrol/issues/7872) *Traffic Router*: Updated Apache Tomcat from 9.0.43, 9.0.67, 9.0.83, and 9.0.86 to 9.0.87. +- [#7933](https://github.com/apache/trafficcontrol/pull/7933), [#8005](https://github.com/apache/trafficcontrol/pull/8005) *Traffic Portal v2*: Update NodeJS version to 18. ### Fixed - [#7998](https://github.com/apache/trafficcontrol/pull/7998) *Traffic Portalv2* Fixed (create and update) page titles across every feature diff --git a/infrastructure/docker/build/Dockerfile-traffic_portal_v2 b/infrastructure/docker/build/Dockerfile-traffic_portal_v2 new file mode 100644 index 0000000000..bf16d5f07a --- /dev/null +++ b/infrastructure/docker/build/Dockerfile-traffic_portal_v2 @@ -0,0 +1,46 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +ARG RHEL_VERSION=8 +FROM rockylinux:${RHEL_VERSION} as common-dependencies +ARG RHEL_VERSION=8 + +MAINTAINER dev@trafficcontrol.apache.org + +# top level of trafficcontrol directory must be mounted as a volume: +# docker run --volume /trafficcontrol:$(pwd) ... +VOLUME /trafficcontrol + +### Common for all sub-component builds +RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-* && \ + rpm --import "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-${RHEL_VERSION%%.*}" && \ + yum -y update ca-certificates && \ + yum -y install \ + git \ + rpm-build \ + rsync \ + epel-release && \ + yum -y clean all && \ + # Add skip git's safe.directory check + git config --global --add safe.directory '*' + +RUN curl -sL https://rpm.nodesource.com/setup_18.x | bash - && \ + yum -y install nodejs + +RUN npm -g install make sass +CMD /trafficcontrol/build/clean_build.sh traffic_portal + +# vi:syntax=Dockerfile diff --git a/infrastructure/docker/build/docker-compose-opt.yml b/infrastructure/docker/build/docker-compose-opt.yml index 7bcb4fdddf..851b7aacee 100644 --- a/infrastructure/docker/build/docker-compose-opt.yml +++ b/infrastructure/docker/build/docker-compose-opt.yml @@ -40,9 +40,9 @@ services: volumes: - ../../..:/trafficcontrol:z traffic_portal_v2_build: - image: apache/traffic_portal_builder:master + image: apache/traffic_portal_v2_builder:master build: - dockerfile: infrastructure/docker/build/Dockerfile-traffic_portal + dockerfile: infrastructure/docker/build/Dockerfile-traffic_portal_v2 context: ../../.. args: # Change BASE_IMAGE to centos when RHEL_VERSION=7