pulsar-client 1.6.2 → 1.8.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/.asf.yaml +8 -1
  2. package/.github/PULL_REQUEST_TEMPLATE.md +85 -0
  3. package/.github/workflows/ci-build-release-napi.yml +213 -0
  4. package/.github/workflows/ci-pr-validation.yml +233 -0
  5. package/README.md +91 -68
  6. package/binding.gyp +48 -39
  7. package/{pulsar-test-service-stop.sh → build-support/dep-version.py} +4 -6
  8. package/build-support/download-release-artifacts.py +74 -0
  9. package/build-support/generate-source-archive.sh +28 -0
  10. package/{pulsar-test-service-start.sh → build-support/pulsar-test-container-start.sh} +11 -21
  11. package/build-support/pulsar-test-service-start.sh +37 -0
  12. package/build-support/pulsar-test-service-stop.sh +32 -0
  13. package/{.github/workflows/nodejs.yml → build-support/sign-files.sh} +13 -12
  14. package/build-support/stage-release.sh +44 -0
  15. package/dependencies.yaml +28 -0
  16. package/docs/release-process.md +271 -0
  17. package/examples/consumer.js +1 -1
  18. package/examples/consumer_listener.js +1 -1
  19. package/examples/consumer_tls_auth.js +1 -1
  20. package/examples/custom_logger.js +60 -0
  21. package/examples/encryption-consumer.js +1 -1
  22. package/examples/encryption-producer.js +1 -1
  23. package/examples/producer.js +1 -1
  24. package/examples/producer_tls_auth.js +1 -1
  25. package/examples/reader.js +1 -1
  26. package/examples/reader_listener.js +1 -1
  27. package/index.d.ts +12 -4
  28. package/index.js +2 -1
  29. package/package.json +16 -13
  30. package/pkg/linux/Dockerfile_linux_glibc +35 -0
  31. package/pkg/linux/Dockerfile_linux_musl +32 -0
  32. package/pkg/linux/build-napi-inside-docker.sh +31 -0
  33. package/pkg/linux/download-cpp-client.sh +65 -0
  34. package/pkg/load_test.js +34 -0
  35. package/pkg/mac/build-cpp-deps-lib.sh +186 -0
  36. package/pkg/mac/build-cpp-lib.sh +48 -0
  37. package/{docker-tests.sh → pkg/mac/common.sh} +13 -13
  38. package/pkg/windows/download-cpp-client.bat +12 -0
  39. package/pulsar-client-cpp.txt +2 -0
  40. package/src/AuthenticationAthenz.js +1 -1
  41. package/src/AuthenticationOauth2.js +1 -1
  42. package/src/AuthenticationTls.js +1 -1
  43. package/src/AuthenticationToken.js +1 -1
  44. package/src/Client.cc +84 -58
  45. package/src/Client.h +6 -4
  46. package/src/Consumer.cc +331 -234
  47. package/src/Consumer.h +11 -9
  48. package/src/ConsumerConfig.cc +54 -32
  49. package/src/ConsumerConfig.h +5 -6
  50. package/src/Message.cc +26 -29
  51. package/src/Message.h +4 -4
  52. package/src/MessageId.cc +19 -22
  53. package/src/MessageId.h +5 -6
  54. package/src/MessageListener.h +3 -8
  55. package/src/Producer.cc +116 -133
  56. package/src/Producer.h +3 -3
  57. package/src/ProducerConfig.cc +39 -22
  58. package/src/ProducerConfig.h +2 -2
  59. package/src/Reader.cc +147 -128
  60. package/src/Reader.h +5 -3
  61. package/src/ReaderConfig.cc +14 -20
  62. package/src/ReaderConfig.h +5 -6
  63. package/src/ReaderListener.h +2 -7
  64. package/src/SchemaInfo.cc +78 -0
  65. package/src/SchemaInfo.h +41 -0
  66. package/src/ThreadSafeDeferred.cc +98 -0
  67. package/src/ThreadSafeDeferred.h +85 -0
  68. package/src/pulsar-binding.js +26 -0
  69. package/tests/conf/standalone.conf +6 -0
  70. package/tests/consumer.test.js +2 -2
  71. package/tests/docker-load-test.sh +35 -0
  72. package/tests/end_to_end.test.js +214 -2
  73. package/tests/load-test.sh +43 -0
  74. package/tests/producer.test.js +2 -2
  75. package/{run-unit-tests.sh → tests/run-unit-tests.sh} +6 -15
  76. package/pulsar-version.txt +0 -1
package/README.md CHANGED
@@ -23,112 +23,135 @@
23
23
 
24
24
  The Pulsar Node.js client can be used to create Pulsar producers and consumers in Node.js.
25
25
 
26
- ## Requirements
27
-
28
- Pulsar Node.js client library is based on the C++ client library. Follow the instructions for
29
- [C++ library](https://pulsar.apache.org/docs/en/client-libraries-cpp/) for installing the binaries through
30
- [RPM](https://pulsar.apache.org/docs/en/client-libraries-cpp/#rpm),
31
- [Deb](https://pulsar.apache.org/docs/en/client-libraries-cpp/#deb) or
32
- [Homebrew packages](https://pulsar.apache.org/docs/en/client-libraries-cpp/#macos).
33
-
34
- (Note: you will need to install not only the pulsar-client library but also the pulsar-client-dev library)
35
-
36
- Also, this library works only in Node.js 10.x or later because it uses the
26
+ This library works only in Node.js 10.x or later because it uses the
37
27
  [node-addon-api](https://github.com/nodejs/node-addon-api) module to wrap the C++ library.
38
28
 
39
- ## Compatibility
40
-
41
- Compatibility between each version of the Node.js client and the C++ client is as follows:
29
+ ## Getting Started
42
30
 
43
- | Node.js client | C++ client |
44
- |----------------|----------------|
45
- | 1.0.x | 2.3.0 or later |
46
- | 1.1.x | 2.4.0 or later |
47
- | 1.2.x | 2.5.0 or later |
48
- | 1.3.x | 2.7.0 or later |
49
- | 1.4.x - 1.5.x | 2.8.0 or later |
50
-
51
- If an incompatible version of the C++ client is installed, you may fail to build or run this library.
31
+ > **Note**
32
+ >
33
+ > These instructions are only available for versions after 1.8.0. For versions previous to 1.8.0, you need to install the C++ client first. Please switch to the corresponding version branch of this repo to read the specific instructions.
34
+ >
35
+ > To run the examples, skip this section.
52
36
 
53
- ## How to install
37
+ To use the Pulsar Node.js client in your project, run:
54
38
 
55
- ### Install on windows
39
+ ```shell
40
+ npm install pulsar-client
41
+ ```
56
42
 
57
- 1. Build the Pulsar C++ client on windows.
43
+ or
58
44
 
59
45
  ```shell
60
- cmake \
61
- -A x64 \
62
- -DBUILD_PYTHON_WRAPPER=OFF -DBUILD_TESTS=OFF \
63
- -DVCPKG_TRIPLET=x64-windows \
64
- -DCMAKE_BUILD_TYPE=Release \
65
- -S .
66
- cmake --config Release
46
+ yarn add pulsar-client
67
47
  ```
68
48
 
49
+ Then you can run the following simple end-to-end example:
50
+
51
+ ```javascript
52
+ const Pulsar = require('pulsar-client');
53
+
54
+ (async () => {
55
+ // Create a client
56
+ const client = new Pulsar.Client({
57
+ serviceUrl: 'pulsar://localhost:6650'
58
+ });
59
+
60
+ // Create a producer
61
+ const producer = await client.createProducer({
62
+ topic: 'persistent://public/default/my-topic',
63
+ });
64
+
65
+ // Create a consumer
66
+ const consumer = await client.subscribe({
67
+ topic: 'persistent://public/default/my-topic',
68
+ subscription: 'sub1'
69
+ });
70
+
71
+ // Send a message
72
+ producer.send({
73
+ data: Buffer.from("hello")
74
+ });
75
+
76
+ // Receive the message
77
+ const msg = await consumer.receive();
78
+ console.log(msg.getData().toString());
79
+ consumer.acknowledge(msg);
80
+
81
+ await producer.close();
82
+ await consumer.close();
83
+ await client.close();
84
+ })();
85
+ ```
69
86
 
70
- 2. Set the variable `PULSAR_CPP_DIR` with the `pulsar-client-cpp` path in a Windows command tool.
87
+ You should find the output as:
71
88
 
72
- ```shell
73
- # for example
74
- set PULSAR_CPP_DIR=C:\pulsar\pulsar-client-cpp
89
+ ```
90
+ hello
75
91
  ```
76
92
 
77
- 3. Set the variable `OS_ARCH` in a Windows command tool, `OS_ARCH` is related to the configuration of VCPKG_TRIPLET on the command line above.(Optional)
93
+ You can see more examples in the [examples](./examples) directory. However, since these examples might use an API that was not released yet, you need to build this module. See the next section.
78
94
 
79
- ```shell
80
- set OS_ARCH=x64-windows
81
- ```
95
+ ## How to build
82
96
 
83
- ### Install on mac
97
+ > **Note**
98
+ >
99
+ > Build from source code requires the Node.js version greater than 16.18
84
100
 
85
- 1. Install the Pulsar C++ client on mac.
101
+ First, clone the repository.
86
102
 
87
103
  ```shell
88
- brew install libpulsar
104
+ git clone https://github.com/apache/pulsar-client-node.git
105
+ cd pulsar-client-node
89
106
  ```
90
107
 
91
- 2. Get the installation path of libpulsar
108
+ Since this client is a [C++ addon](https://nodejs.org/api/addons.html#c-addons) that depends on the [Pulsar C++ client](https://github.com/apache/pulsar-client-cpp), you need to install the C++ client first. You need to ensure there is a C++ compiler that supports C++11 installed in your system.
109
+
110
+ - Install C++ client on Linux:
92
111
 
93
112
  ```shell
94
- brew info libpulsar
113
+ pkg/linux/download-cpp-client.sh
95
114
  ```
96
115
 
97
-
98
- 2. Set the variable `PULSAR_CPP_DIR` with the `pulsar-client-cpp` path in a mac command tool.
116
+ - Install C++ client on Windows:
99
117
 
100
118
  ```shell
101
- # for example
102
- export PULSAR_CPP_DIR=/usr/local/Cellar/libpulsar/2.9.1_1
119
+ pkg\windows\download-cpp-client.bat
103
120
  ```
104
121
 
105
-
106
- ### Install pulsar-client to your project
122
+ - Install C++ client on macOS:
107
123
 
108
124
  ```shell
109
- $ npm install pulsar-client
125
+ pkg/mac/build-cpp-deps-lib.sh
126
+ pkg/mac/build-cpp-lib.sh
110
127
  ```
111
128
 
112
- ## Sample code
113
-
114
- Please refer to [examples](https://github.com/apache/pulsar-client-node/tree/master/examples).
129
+ After the C++ client is installed, run the following command to build this C++ addon.
115
130
 
116
- ## How to build
131
+ ```shell
132
+ npm install
133
+ ```
117
134
 
118
- ### Install dependent npm modules and build Pulsar client library:
135
+ To verify it has been installed successfully, you can run an example like:
119
136
 
120
137
  ```shell
121
- $ git clone https://github.com/apache/pulsar-client-node.git
122
- $ cd pulsar-client-node
123
- $ npm install
138
+ node examples/producer
124
139
  ```
125
140
 
126
- > **Note**
127
- >
128
- > If you build `pulsar-client-node on` windows, you need to set the variable `PULSAR_CPP_DIR` first, then install npm (run the command `npm install`) in a Windows command-line tool.
129
-
130
- ### Rebuild Pulsar client library:
141
+ You should find the output as:
131
142
 
132
- ```shell
133
- $ npm run build
134
143
  ```
144
+ Sent message: my-message-0
145
+ Sent message: my-message-1
146
+ Sent message: my-message-2
147
+ Sent message: my-message-3
148
+ Sent message: my-message-4
149
+ Sent message: my-message-5
150
+ Sent message: my-message-6
151
+ Sent message: my-message-7
152
+ Sent message: my-message-8
153
+ Sent message: my-message-9
154
+ ```
155
+
156
+ ## Documentation
157
+ * Please see https://pulsar.apache.org/docs/client-libraries-node/ for more details about the Pulsar Node.js client.
package/binding.gyp CHANGED
@@ -18,86 +18,95 @@
18
18
  #
19
19
 
20
20
  {
21
- 'conditions': [
22
- ['OS=="win"', {
23
- 'variables': {
24
- 'pulsar_cpp_dir%': '<!(echo %PULSAR_CPP_DIR%)',
25
- 'os_arch%': '<!(echo %OS_ARCH%)',
26
- },
27
- }],
28
- ['OS=="mac"', {
29
- 'variables': {
30
- 'pulsar_cpp_dir': '<!(echo $PULSAR_CPP_DIR)'
31
- }
32
- }]
33
- ],
34
21
  "targets": [
35
22
  {
36
- "target_name": "Pulsar",
23
+ "target_name": "pulsar",
37
24
  "cflags_cc": ["-std=gnu++11"],
38
25
  "cflags!": ["-fno-exceptions"],
39
26
  "cflags_cc!": ["-fno-exceptions", "-std=gnu++14", "-std=gnu++17"],
40
27
  "include_dirs": [
41
28
  "<!@(node -p \"require('node-addon-api').include\")",
42
29
  ],
43
- "defines": ["NAPI_VERSION=4", "NAPI_DISABLE_CPP_EXCEPTIONS=1"],
30
+ "defines": ["NAPI_VERSION=4"],
44
31
  "sources": [
45
32
  "src/addon.cc",
46
33
  "src/Message.cc",
47
34
  "src/MessageId.cc",
48
35
  "src/Authentication.cc",
49
36
  "src/Client.cc",
37
+ "src/SchemaInfo.cc",
50
38
  "src/Producer.cc",
51
39
  "src/ProducerConfig.cc",
52
40
  "src/Consumer.cc",
53
41
  "src/ConsumerConfig.cc",
54
42
  "src/Reader.cc",
55
43
  "src/ReaderConfig.cc",
44
+ "src/ThreadSafeDeferred.cc"
56
45
  ],
57
46
  'conditions': [
58
47
  ['OS=="mac"', {
48
+ 'xcode_settings': {
49
+ 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
50
+ 'GCC_ENABLE_CPP_RTTI': 'YES',
51
+ 'MACOSX_DEPLOYMENT_TARGET': '11.0',
52
+ 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++11',
53
+ 'OTHER_CFLAGS': [
54
+ "-fPIC",
55
+ ]
56
+ },
57
+ "dependencies": [
58
+ "<!@(node -p \"require('node-addon-api').gyp\")"
59
+ ],
59
60
  "include_dirs": [
60
- "<(pulsar_cpp_dir)/include",
61
+ "pkg/mac/build-pulsar/install/include"
61
62
  ],
62
63
  "libraries": [
63
- "<(pulsar_cpp_dir)/lib/libpulsar.dylib"
64
+ "../pkg/mac/build-pulsar/install/lib/libpulsarwithdeps.a"
64
65
  ],
65
66
  }],
66
67
  ['OS=="win"', {
68
+ "defines": [
69
+ "_HAS_EXCEPTIONS=1",
70
+ "PULSAR_STATIC"
71
+ ],
72
+ "msvs_settings": {
73
+ "VCCLCompilerTool": {
74
+ "ExceptionHandling": 1
75
+ },
76
+ },
67
77
  "include_dirs": [
68
- "<(pulsar_cpp_dir)\include",
78
+ "pkg\\windows\\pulsar-cpp\\include",
69
79
  ],
70
80
  "libraries": [
71
- "-l<(pulsar_cpp_dir)\\lib\Release\pulsar.lib"
81
+ "..\\pkg\\windows\\pulsar-cpp\\lib\\pulsarWithDeps.lib"
72
82
  ],
73
83
  "dependencies": [
74
84
  "<!(node -p \"require('node-addon-api').gyp\")"
75
- ],
76
- "copies": [
77
- {
78
- "destination": "<(PRODUCT_DIR)",
79
- "files": [
80
- "<(pulsar_cpp_dir)\\lib\Release\pulsar.dll",
81
- "<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\libcurl.dll",
82
- "<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\libprotobuf.dll",
83
- "<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\libssl-1_1-x64.dll",
84
- "<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\libcrypto-1_1-x64.dll",
85
- "<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\dl.dll",
86
- "<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\snappy.dll",
87
- "<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\zlib1.dll",
88
- "<(pulsar_cpp_dir)\\vcpkg_installed\\<(os_arch)\\bin\zstd.dll",
89
- ]
90
- }
91
85
  ]
92
- }, { # 'OS!="win"'
93
- "libraries": [
94
- "-lpulsar",
95
- ],
86
+ }],
87
+ ['OS=="linux"', {
96
88
  "dependencies": [
97
89
  "<!@(node -p \"require('node-addon-api').gyp\")"
98
90
  ],
91
+ "include_dirs": [
92
+ "pkg/linux/pulsar-cpp/include"
93
+ ],
94
+ "libraries": [
95
+ "../pkg/linux/pulsar-cpp/lib/libpulsarwithdeps.a"
96
+ ],
99
97
  }]
100
98
  ]
99
+ },
100
+ {
101
+ "target_name": "action_after_build",
102
+ "type": "none",
103
+ "dependencies": [ "<(module_name)" ],
104
+ "copies": [
105
+ {
106
+ "files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
107
+ "destination": "<(module_path)"
108
+ }
109
+ ]
101
110
  }
102
111
  ]
103
112
  }
@@ -1,4 +1,4 @@
1
- #!/bin/bash
1
+ #!/usr/bin/env python3
2
2
  #
3
3
  # Licensed to the Apache Software Foundation (ASF) under one
4
4
  # or more contributor license agreements. See the NOTICE file
@@ -18,9 +18,7 @@
18
18
  # under the License.
19
19
  #
20
20
 
21
- set -e
21
+ import yaml, sys
22
22
 
23
- PULSAR_DIR="${PULSAR_DIR:-/tmp/pulsar-test-dist}"
24
- cd $PULSAR_DIR
25
-
26
- bin/pulsar-daemon stop standalone
23
+ deps = yaml.safe_load(open("dependencies.yaml"))
24
+ print(deps[sys.argv[1]])
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env python3
2
+ #
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+ #
20
+
21
+ import sys, json, urllib.request, os, shutil, zipfile, tempfile
22
+ from pathlib import Path
23
+
24
+ if len(sys.argv) != 3:
25
+ print("Usage: ")
26
+ print(" %s $WORKFLOW_RUN_ID $DEST_PATH" % sys.argv[0])
27
+ sys.exit(-1)
28
+
29
+ if 'GITHUB_TOKEN' not in os.environ:
30
+ print('You should have a GITHUB_TOKEN environment variable')
31
+ sys.exit(-1)
32
+
33
+ GITHUB_TOKEN = os.environ['GITHUB_TOKEN']
34
+
35
+ ACCEPT_HEADER = 'application/vnd.github+json'
36
+ LIST_URL = 'https://api.github.com/repos/apache/pulsar-client-node/actions/runs/%d/artifacts'
37
+
38
+ workflow_run_id = int(sys.argv[1])
39
+ dest_path = sys.argv[2]
40
+
41
+ workflow_run_url = LIST_URL % workflow_run_id
42
+ request = urllib.request.Request(workflow_run_url,
43
+ headers={'Accept': ACCEPT_HEADER, 'Authorization': 'Bearer ' + GITHUB_TOKEN})
44
+ with urllib.request.urlopen(request) as response:
45
+ data = json.loads(response.read().decode("utf-8"))
46
+ for artifact in data['artifacts']:
47
+ name = artifact['name']
48
+ url = artifact['archive_download_url']
49
+
50
+ print('Downloading %s from %s' % (name, url))
51
+ artifact_request = urllib.request.Request(url,
52
+ headers={'Authorization': 'Bearer ' + GITHUB_TOKEN})
53
+ with urllib.request.urlopen(artifact_request) as response:
54
+ tmp_zip = tempfile.NamedTemporaryFile(delete=False)
55
+ try:
56
+ #
57
+ shutil.copyfileobj(response, tmp_zip)
58
+ tmp_zip.close()
59
+
60
+ dest_dir = os.path.join(dest_path, name)
61
+ Path(dest_dir).mkdir(parents=True, exist_ok=True)
62
+ with zipfile.ZipFile(tmp_zip.name, 'r') as z:
63
+ z.extractall(dest_dir)
64
+ finally:
65
+ os.unlink(tmp_zip.name)
66
+
67
+ for root, dirs, files in os.walk(dest_path, topdown=False):
68
+ for name in files:
69
+ shutil.move(os.path.join(root, name), dest_path)
70
+ if not os.listdir(root):
71
+ os.rmdir(root)
72
+
73
+
74
+
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+ #
20
+ ROOT_DIR=$(git rev-parse --show-toplevel)
21
+
22
+ VERSION=$(npm version | grep pulsar-client | awk -F ':' '{print $2}' | sed "s?'??g" | sed "s?,??g" | sed "s? ??g")
23
+
24
+ NAME=apache-pulsar-client-node-$VERSION
25
+
26
+ OUT_DIR=${1:-.}
27
+
28
+ git archive --format=tar.gz --prefix ${NAME}/ -o ${OUT_DIR}/${NAME}.tar.gz HEAD
@@ -1,4 +1,4 @@
1
- #!/bin/bash
1
+ #!/usr/bin/env bash
2
2
  #
3
3
  # Licensed to the Apache Software Foundation (ASF) under one
4
4
  # or more contributor license agreements. See the NOTICE file
@@ -18,28 +18,18 @@
18
18
  # under the License.
19
19
  #
20
20
 
21
- set -e
21
+ set -e -x
22
22
 
23
- ROOT_DIR=$(git rev-parse --show-toplevel)
24
- cd $ROOT_DIR
25
-
26
- VERSION="${VERSION:-`cat ./pulsar-version.txt`}"
27
- PULSAR_DIR="${PULSAR_DIR:-/tmp/pulsar-test-dist}"
28
- PKG=apache-pulsar-${VERSION}-bin.tar.gz
29
-
30
- rm -rf $PULSAR_DIR
31
- curl -L --create-dir "https://archive.apache.org/dist/pulsar/pulsar-${VERSION}/${PKG}" -o $PULSAR_DIR/$PKG
32
- tar xfz $PULSAR_DIR/$PKG -C $PULSAR_DIR --strip-components 1
33
-
34
- DATA_DIR=/tmp/pulsar-test-data
35
- rm -rf $DATA_DIR
36
- mkdir -p $DATA_DIR
37
-
38
- export PULSAR_STANDALONE_CONF=$ROOT_DIR/tests/conf/standalone.conf
39
- $PULSAR_DIR/bin/pulsar-daemon start standalone \
23
+ export PULSAR_STANDALONE_CONF=test-conf/standalone.conf
24
+ # There is an issue when starting the pulsar standalone with other metadata store: https://github.com/apache/pulsar/issues/17984
25
+ # We need to use Zookeeper here. Otherwise the `Message Chunking` test will not pass.
26
+ # We can remove this line after the pulsar release a new version contains this fix: https://github.com/apache/pulsar/pull/18126
27
+ export PULSAR_STANDALONE_USE_ZOOKEEPER=1
28
+ bin/pulsar-daemon start standalone \
40
29
  --no-functions-worker --no-stream-storage \
41
- --zookeeper-dir $DATA_DIR/zookeeper \
42
- --bookkeeper-dir $DATA_DIR/bookkeeper
30
+ --bookkeeper-dir data/bookkeeper
43
31
 
44
32
  echo "-- Wait for Pulsar service to be ready"
45
33
  until curl http://localhost:8080/metrics > /dev/null 2>&1 ; do sleep 1; done
34
+
35
+ echo "-- Ready to start tests"
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+ #
20
+
21
+ set -e
22
+
23
+ SRC_DIR=$(git rev-parse --show-toplevel)
24
+ cd $SRC_DIR
25
+
26
+ build-support/pulsar-test-service-stop.sh
27
+
28
+ CONTAINER_ID=$(docker run -i -p 8080:8080 -p 6650:6650 -p 8443:8443 -p 6651:6651 --rm --detach apachepulsar/pulsar:2.10.2 sleep 3600)
29
+
30
+ echo $CONTAINER_ID >.tests-container-id.txt
31
+
32
+ docker cp $SRC_DIR/tests/conf $CONTAINER_ID:/pulsar/test-conf
33
+ docker cp $SRC_DIR/build-support/pulsar-test-container-start.sh $CONTAINER_ID:pulsar-test-container-start.sh
34
+
35
+ docker exec -i $CONTAINER_ID /pulsar-test-container-start.sh
36
+
37
+ echo "-- Ready to start tests"
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+ #
20
+
21
+ set -e
22
+
23
+ SRC_DIR=$(git rev-parse --show-toplevel)
24
+ cd $SRC_DIR
25
+
26
+ CONTAINER_ID_PATH=".tests-container-id.txt"
27
+
28
+ if [ -f ${CONTAINER_ID_PATH} ]; then
29
+ CONTAINER_ID=$(cat $CONTAINER_ID_PATH)
30
+ docker kill $CONTAINER_ID || true
31
+ rm .tests-container-id.txt
32
+ fi
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env bash
1
2
  #
2
3
  # Licensed to the Apache Software Foundation (ASF) under one
3
4
  # or more contributor license agreements. See the NOTICE file
@@ -16,16 +17,16 @@
16
17
  # specific language governing permissions and limitations
17
18
  # under the License.
18
19
  #
19
- name: Node.js
20
- on: [pull_request]
21
- jobs:
22
- build:
23
- name: Build
24
- runs-on: ubuntu-latest
25
- steps:
26
- - name: Check out code into the Node.js module directory
27
- uses: actions/checkout@v2
28
20
 
29
- - name: Test
30
- run: |
31
- ./docker-tests.sh
21
+ set -e
22
+
23
+ FILES=$*
24
+
25
+ for FILE in $FILES
26
+ do
27
+ echo "Signing $FILE"
28
+ gpg --armor --output $FILE.asc --detach-sig $FILE
29
+
30
+ # SHA-512 signature
31
+ shasum -a 512 $FILE > $FILE.sha512
32
+ done
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Licensed to the Apache Software Foundation (ASF) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The ASF licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+ #
20
+
21
+ set -e -x
22
+
23
+ if [ $# -neq 2 ]; then
24
+ echo "Usage: $0 \$DEST_PATH \$WORKFLOW_ID"
25
+ exit 1
26
+ fi
27
+
28
+ DEST_PATH=$(readlink -f $1)
29
+ WORKFLOW_ID=$2
30
+
31
+ pushd $(dirname "$0")
32
+ PULSAR_NODE_PATH=$(git rev-parse --show-toplevel)
33
+ popd
34
+
35
+ mkdir -p $DEST_PATH
36
+
37
+ cd $PULSAR_NODE_PATH
38
+
39
+ build-support/download-release-artifacts.py $WORKFLOW_ID $DEST_PATH
40
+ build-support/generate-source-archive.sh $DEST_PATH
41
+
42
+ # Sign all files
43
+ cd $DEST_PATH
44
+ find . -type f | xargs $PULSAR_NODE_PATH/build-support/sign-files.sh