Skip to content

Commit 88f5761

Browse files
zhangeamonzhangeamon
authored andcommitted
2 parents 41f1560 + 6db5550 commit 88f5761

7 files changed

Lines changed: 112 additions & 41 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ RUN UPX_VERSION=4.1.0; \
7373
tar -Jxvf upx-${UPX_VERSION}-${OS_ARCH}_linux.tar.xz; \
7474
cp upx-${UPX_VERSION}-${OS_ARCH}_linux/upx /usr/local/bin; \
7575
rm -rf upx-*; \
76-
pip install oss2;
76+
pip install oss2 packaging;

build.sh

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,52 @@ function renew() {
7373
git push --tag
7474
}
7575

76+
function patch() {
77+
# Validate arguments
78+
if [[ $# -ne 3 ]]; then
79+
echo "Usage: ${FUNCNAME[0]} <tar.gz> <inner_file> <replacement>" >&2
80+
return 1
81+
fi
82+
local tar_file="$1"
83+
local inner_file="$2"
84+
local replacement_file="$3"
85+
# Check if files exist
86+
if [[ ! -f "$tar_file" ]]; then
87+
echo "Error: Tar file '$tar_file' not found" >&2
88+
return 1
89+
fi
90+
if [[ ! -f "$replacement_file" ]]; then
91+
echo "Error: Replacement file '$replacement_file' not found" >&2
92+
return 1
93+
fi
94+
# Create temporary directory
95+
local temp_dir
96+
temp_dir=$(mktemp -d) || {
97+
echo "Error: Failed to create temporary directory" >&2
98+
return 1
99+
}
100+
trap "rm -rf '$temp_dir'" EXIT
101+
# Extract tar file
102+
if ! tar -xzf "$tar_file" -C "$temp_dir" 2>/dev/null; then
103+
echo "Error: Failed to extract '$tar_file'" >&2
104+
return 1
105+
fi
106+
# Check if inner file exists in archive
107+
if [[ ! -f "${temp_dir}/${inner_file}" ]]; then
108+
echo "Error: File '$inner_file' not found in archive" >&2
109+
return 1
110+
fi
111+
# Replace the file
112+
if ! cp "$replacement_file" "${temp_dir}/${inner_file}"; then
113+
echo "Error: Failed to replace file" >&2
114+
return 1
115+
fi
116+
117+
tar --numeric-owner -czf "${tar_file: :-7}.patched.tar.gz" -C "$temp_dir" . --transform='s,^./,,'
118+
echo "Success: File replaced in '$tar_file'"
119+
return 0
120+
}
121+
76122
function clean-tags() {
77123
for tag in $(git tag --sort creatordate|head -n "$1")
78124
do
@@ -99,4 +145,4 @@ if ! _is_sourced; then
99145
action=$1
100146
shift 1
101147
$action "$@"
102-
fi
148+
fi

scripts/checker.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@
3838
"owner": "dbeaver",
3939
"match": "[2-9]{1,}\.[0-9]{1,}\.[0-9]{1,}$",
4040
},
41-
"vouch-proxy": {
42-
"name": "vouch-proxy",
43-
"type": "github",
44-
"owner": "vouch",
45-
"match": "^v[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}$",
46-
},
4741
"redis_exporter": {
4842
"name": "redis_exporter",
4943
"type": "github",
@@ -224,6 +218,12 @@
224218
"owner": "python",
225219
"match": "^v[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}$",
226220
},
221+
"quickwit": {
222+
"name": "quickwit",
223+
"type": "github",
224+
"owner": "quickwit-oss",
225+
"match": "^v[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}$",
226+
},
227227
"rabbitmq": {
228228
"name": "rabbitmq-server",
229229
"type": "github",
@@ -380,6 +380,12 @@
380380
"owner": "opensearch-project",
381381
"match": "^[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}$",
382382
},
383+
"opentelemetry-collector": {
384+
"name": "opentelemetry-collector",
385+
"type": "github",
386+
"owner": "open-telemetry",
387+
"match": "^v[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}$",
388+
},
383389
"seaweedfs": {
384390
"name": "seaweedfs",
385391
"type": "github",

scripts/storage.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import re
33
import sys
44
import oss2
5+
from packaging.version import parse
56

67

78
bucket = oss2.Bucket(
@@ -48,18 +49,20 @@ def upload_list(stack_name, dist_dir):
4849

4950

5051
def symlink(stack_name, version):
51-
symlink_list = []
5252
object_list = [
5353
obj.key for obj in bucket.list_objects(
5454
f"stacks/{stack_name}/{stack_name}-{version}.").object_list
5555
]
56-
object_list.sort(reverse=True)
56+
prefix = f"stacks/{stack_name}/{stack_name}-"
57+
version_list = sorted(
58+
[obj.replace(prefix, "").split("-", 1)[0] for obj in object_list],
59+
key=parse,
60+
reverse=True,
61+
)
5762
for obj in object_list:
58-
name = f"stacks/{stack_name}/{stack_name}-{version}"
59-
symlink = re.sub("%s.([0-9]\.?){1,}" % name, name, obj)
60-
if symlink != obj and symlink not in symlink_list:
63+
if obj.startswith(f"{prefix}{version_list[0]}-"):
64+
symlink = re.sub("%s.([0-9]\.?){1,}" % f"{prefix}{version}", f"{prefix}{version}", obj)
6165
bucket.put_symlink(obj, symlink)
62-
symlink_list.append(symlink)
6366

6467

6568
if __name__ == "__main__":
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# Load stack utils
4+
. /usr/bin/stack-utils
5+
6+
# Implement build function
7+
function build() {
8+
generate-stack-path
9+
curl -sSL https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v${STACK_VERSION}/otelcol-contrib_${STACK_VERSION}_linux_${OS_ARCH}.tar.gz | tar -xvz
10+
11+
BIN_DIR="${DATA_DIR}"/bin
12+
mkdir -p "${BIN_DIR}"
13+
mv otelcol-contrib "${BIN_DIR}"/otelcol
14+
rm -rf README.md
15+
#upx
16+
upx --lzma --best "${BIN_DIR}"/*
17+
}
18+
19+
# call build stack
20+
build-stack "${1}"

stacks/quickwit/build.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
# Load stack utils
4+
. /usr/bin/stack-utils
5+
6+
# Implement build function
7+
function build() {
8+
generate-stack-path
9+
10+
curl -sSL "https://github.com/quickwit-oss/quickwit/releases/download/v${STACK_VERSION}/quickwit-v${STACK_VERSION}-$(uname -m)-unknown-linux-gnu.tar.gz" | tar -xz
11+
BIN_DIR="${DATA_DIR}"/bin
12+
mkdir -p "${BIN_DIR}"
13+
14+
cp quickwit-v${STACK_VERSION}/quickwit "${BIN_DIR}"
15+
cp -rf quickwit-v${STACK_VERSION}/config "${DATA_DIR}"
16+
rm -rf quickwit-v${STACK_VERSION}
17+
18+
# upx
19+
upx --lzma --best "${BIN_DIR}"/*
20+
}
21+
22+
# call build stack
23+
build-stack "${1}"

stacks/vouch-proxy/build.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)