Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Commit

Permalink
Stop testing with Node <v10; upgrade tchannel->4.x (#463)
Browse files Browse the repository at this point in the history
* Stop testing with Node <v10, add latest versions

Signed-off-by: Yuri Shkuro <[email protected]>

* update

Signed-off-by: Yuri Shkuro <[email protected]>

* Upgrade tchannel to 4.x, use node-alpine for crossdock

Signed-off-by: Yuri Shkuro <[email protected]>

* cleanup

Signed-off-by: Yuri Shkuro <[email protected]>

* cleanup

Signed-off-by: Yuri Shkuro <[email protected]>

* cleanup

Signed-off-by: Yuri Shkuro <[email protected]>
  • Loading branch information
yurishkuro authored Apr 28, 2021
1 parent 4c739a2 commit 6a6e3ea
Show file tree
Hide file tree
Showing 9 changed files with 440 additions and 167 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/ci-crossdock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
crossdock:
env:
NODE_LTS: "10"
NODE_LTS: "14"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -46,16 +46,8 @@ jobs:

- name: Install Dependencies
run: |
npm install babel-cli
sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6'
npm uninstall -D husky lint-staged
make node-modules
make build-node
rm -rf ./node_modules package-lock.json
- uses: actions/setup-node@v2
with:
node-version: "0.10"
- name: Run Crossdock
id: run-crossdock
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/ci-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ jobs:
unit-tests:
runs-on: ubuntu-latest
env:
NODE_LTS: "10"
# Current Active LTS is 14: https://nodejs.org/en/about/releases/.
# This must match LTS_NODE_VER in Makefile and `.npmrc`.
NODE_LTS: "14"
strategy:
matrix:
env:
- TEST_NODE_VERSION: "0.10"
- TEST_NODE_VERSION: "4"
- TEST_NODE_VERSION: "6"
- TEST_NODE_VERSION: "10"
- TEST_NODE_VERSION: "12"
- TEST_NODE_VERSION: "14"
LINT: "1"
COVER: "1"
- TEST_NODE_VERSION: "12"
- TEST_NODE_VERSION: "16"
name: unit-tests - node ${{ matrix.env.TEST_NODE_VERSION }}
steps:
- uses: actions/checkout@v2
Expand All @@ -35,11 +36,8 @@ jobs:

- name: Install Base Project
run: |
npm install babel-cli
npm uninstall -D husky lint-staged
make node-modules
make build-node
rm -rf ${{ github.workspace }}/node_modules/ ${{ github.workspace }}/package-lock.json
rm -rf ${{ github.workspace }}/node_modules/ ${{ github.workspace }}/package-lock.json
- name: Configure Test Node Version
uses: actions/setup-node@v2
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/dubnium
lts/fermium
32 changes: 6 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
-include crossdock/rules.mk

LTS_NODE_VER=14
NODE_VER=$(shell node -v)
ifeq ($(patsubst v10.%,matched,$(NODE_VER)), matched)
ifeq ($(patsubst v$(LTS_NODE_VER).%,matched,$(NODE_VER)), matched)
NODE_LTS=true
else
NODE_LTS=false
endif
ifeq ($(patsubst v0.10%,matched,$(NODE_VER)), matched)
NODE_0_10=true
else
NODE_0_10=false
endif

.PHONY: publish
publish: build-node
Expand All @@ -20,37 +16,21 @@ publish: build-node
# Update Changelog.md to relfect the newest version changes.

.PHONY: test
test: build-node
make test-without-build
test: build-node test-without-build

.PHONY: test-without-build
test-without-build: install-test-deps
test-without-build:
npm run flow
ifeq ($(NODE_LTS),true)
npm run test-all
endif
npm run test-dist
npm run check-license

.PHONY: test-without-install
test-without-install: build-without-install
npm run flow
ifeq ($(NODE_LTS),true)
npm run test-all
endif
npm run test-dist
npm run check-license

.PHONY: install-test-deps
install-test-deps:
ifeq ($(NODE_0_10), false)
npm install --no-save [email protected]
endif

.PHONY: check-node-lts
check-node-lts:
@$(NODE_LTS) || echo Build requires Node 10.x
@$(NODE_LTS) && echo Building using Node 10.x
@$(NODE_LTS) || echo Build requires Node v$(LTS_NODE_VER)
@$(NODE_LTS) && echo Building using Node v$(LTS_NODE_VER)

.PHONY: build-node
build-node: check-node-lts node-modules build-without-install
Expand Down
21 changes: 7 additions & 14 deletions crossdock/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
# 2020-07-16: the source image used to be woorank/docker-node-babel.
# However, it is no longer available from Docker Hub.
# It was republished from a local cache as jaegertracing/xdock-node:docker-node-babel.
# woorank/docker-node-babel latest 1fef8ea9e76f 4 years ago 778MB
# jaegertracing/xdock-node docker-node-babel 1fef8ea9e76f 4 years ago 778MB
FROM node:14-alpine

FROM jaegertracing/xdock-node:docker-node-babel
# tchannel uses node-gyp to compile native libs, which requires python.
RUN apk update && apk add python g++ make bash && rm -rf /var/cache/apk/*

EXPOSE 8080-8082

ADD node_modules/ /node_modules
ADD package.json /
ADD package-lock.json /
ADD src/ /src
ADD src/jaeger-idl/thrift/crossdock/tracetest.thrift /crossdock/tracetest.thrift
ADD crossdock/src /crossdock/src
ADD crossdock/src/ /crossdock/src
ADD .babelrc /

# We re-install tchannel because it is the only depenency that requires native code compilation.
# Doing a full npm install inside the container would make this build really slow.
# We pin tchannel to v3, because v4 removed support for Node-v0.10.
RUN npm install [email protected]
RUN npm ls
RUN npm install

CMD ["/crossdock/src/driver.sh"]
CMD ["/bin/bash", "/crossdock/src/driver.sh"]
22 changes: 5 additions & 17 deletions crossdock/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ PROJECT=crossdock
XDOCK_YAML=$(PROJECT)/docker-compose.yml

.PHONY: crossdock
crossdock: install_node_modules
docker-compose -f $(XDOCK_YAML) kill node
crossdock: crossdock-kill
docker-compose -f $(XDOCK_YAML) rm -f node
docker-compose -f $(XDOCK_YAML) build node
docker-compose -f $(XDOCK_YAML) run crossdock

.PHONY: crossdock-fresh
crossdock-fresh: install_node_modules
docker-compose -f $(XDOCK_YAML) kill
crossdock-fresh: crossdock-kill
docker-compose -f $(XDOCK_YAML) rm --force
docker-compose -f $(XDOCK_YAML) pull
docker-compose -f $(XDOCK_YAML) build --no-cache
Expand All @@ -20,16 +18,6 @@ crossdock-fresh: install_node_modules
crossdock-logs:
docker-compose -f $(XDOCK_YAML) logs

.PHONY: install_node_modules
install_node_modules:
npm install
npm uninstall tchannel

.PHONY: install_docker_ci
install_docker_ci:
@echo "Installing docker-compose $${DOCKER_COMPOSE_VERSION:?'DOCKER_COMPOSE_VERSION env not set'}"
sudo rm -f /usr/local/bin/docker-compose
curl -L https://github.com/docker/compose/releases/download/$${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
chmod +x docker-compose
sudo mv docker-compose /usr/local/bin
docker-compose version
.PHONY: crossdock-kill
crossdock-kill:
docker-compose -f $(XDOCK_YAML) kill
7 changes: 6 additions & 1 deletion crossdock/src/driver.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#!/bin/bash

set -x

/node_modules/.bin/babel-node /crossdock/src/http_server.js &
/node_modules/.bin/babel-node /crossdock/src/tchannel_server.js &

sleep 10
# unfortunately, we do not check that the above two servers are ready
# before starting the healthcheck handler, so give them some time.
sleep 20

/node_modules/.bin/babel-node /crossdock/src/healthcheck_server.js &

sleep infinity
Loading

0 comments on commit 6a6e3ea

Please sign in to comment.