Skip to content

Commit 8f2c1a5

Browse files
authored
Merge pull request #167 from zowe/v3.x/feature/version
Print version in `ZWEL0021I Zowe Launcher starting <version>`
2 parents 2aa18e6 + 3b5d144 commit 8f2c1a5

File tree

7 files changed

+87
-38
lines changed

7 files changed

+87
-38
lines changed

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
All notable changes to the Zowe Launcher package will be documented in this file.
44
This repo is part of the app-server Zowe Component, and the change logs here may appear on Zowe.org in that section.
55

6-
## 3.3
7-
- Bugfix: `zowe.sysMessages` feature was ignoring messages where the matching string was after the position of 126 ([#157]https://github.com/zowe/launcher/pull/157)
6+
## 3.4.0
7+
- Enhancement: Message `ZWEL0021I` includes the version of launcher ([#167](https://github.com/zowe/launcher/pull/167))
8+
9+
## 3.3.0
10+
- Bugfix: `zowe.sysMessages` feature was ignoring messages where the matching string was after the position of 126 ([#157](https://github.com/zowe/launcher/pull/157))
811
- Enhancement: Launcher can now accept PARMLIB CONFIG entries that have more than one member name ([#146](https://github.com/zowe/launcher/pull/146))
912
- Enhancement: Trimming the sys messages to print from the sys-message-id as optional based on the zowe.sysMessageTrim=true/false. (#147)
1013
- Enhancement: Avoid starting individual apiml components when apiml modulith is enabled ([#160](https://github.com/zowe/launcher/pull/160))
1114

12-
## 3.1
15+
## 3.1.0
1316
- Bugfix: HEAPPOOLS and HEAPPOOLS64 no longer need to be set to OFF for launcher (#133)
1417

1518
## 2.17.0

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Copyright Contributors to the Zowe Project.
99
<h1 align="center">Zowe Launcher</h1>
1010

1111
The Zowe launcher is a part of the Zowe server architecture that was added as an optional program for HA/FT usage in v1.
12-
In v2, the Zowe laucher became the sole way to start the Zowe servers.
12+
In v2, the Zowe launcher became the sole way to start the Zowe servers.
1313
The launcher's purpose is to start, restart, and stop each Zowe server component which has a `start` command,
1414
and in doing so it watches over such components for health (restarting them if they crash) and log management.
1515

@@ -25,12 +25,20 @@ and in doing so it watches over such components for health (restarting them if t
2525

2626
## Building
2727

28-
```
28+
The Zowe launcher is build with a version defined in [manifest.yaml](./manifest.yaml). This version is used in `ZWEL0021I` message.
29+
30+
```shell
2931
cd zowe-launcher/build
3032
./build.sh
3133
```
3234

33-
The launcher binary will be saved into the bin directory.
35+
For development purposes, it is possible to specify custom defined version, which must be compound from three numeric values and dots: for example `1.2.3`. Invalid version will be used as `0.0.0`.
36+
```shell
37+
cd zowe-launcher/build
38+
export LAUNCHER_VERSION=1.2.3 && ./build.sh
39+
```
40+
41+
The launcher binary will be saved into the `bin` directory.
3442

3543
## Testing
3644

build/build.sh

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# This program and the accompanying materials are
44
# made available under the terms of the Eclipse Public License v2.0 which accompanies
55
# this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html
6-
#
6+
#
77
# SPDX-License-Identifier: EPL-2.0
8-
#
8+
#
99
# Copyright Contributors to the Zowe Project.
1010

1111
WORKING_DIR=$(cd $(dirname "$0") && pwd)
@@ -18,7 +18,7 @@ WORKING_DIR=$(cd $(dirname "$0") && pwd)
1818
echo "********************************************************************************"
1919
echo "Building $PROJECT..."
2020

21-
LAUNCHER="$WORKING_DIR/.."
21+
LAUNCHER_DIR="$WORKING_DIR/.."
2222

2323
# Checks for and possibly downloads dependencies from env vars from above file
2424
. $WORKING_DIR/dependencies.sh
@@ -28,45 +28,43 @@ DEPS_DESTINATION=$(get_destination "${WORKING_DIR}/.." "${PROJECT}")
2828
# These paths assume that the build is run from /launcher/builds
2929

3030
date_stamp=$(date +%Y%m%d%S)
31+
launcher_date_stamp=$(date +%Y%m%d)
3132

3233
TMP_DIR="${WORKING_DIR}/tmp-${date_stamp}"
3334

3435
mkdir -p "${TMP_DIR}" && cd "${TMP_DIR}"
3536

36-
37-
# Split version into parts
37+
# Split LIBYAML version into parts
3838
OLDIFS=$IFS
3939
IFS="."
40-
for part in ${VERSION}; do
41-
if [ -z "$MAJOR" ]; then
42-
MAJOR=$part
43-
elif [ -z "$MINOR" ]; then
44-
MINOR=$part
40+
for part in ${LIBYAML_BRANCH}; do
41+
if [ -z "$LIBYAML_MAJOR" ]; then
42+
LIBYAML_MAJOR=$part
43+
elif [ -z "$LIBYAML_MINOR" ]; then
44+
LIBYAML_MINOR=$part
4545
else
46-
PATCH=$part
46+
LIBYAML_PATCH=$part
4747
fi
4848
done
4949
IFS=$OLDIFS
5050

51-
VERSION="\"${VERSION}\""
52-
53-
rm -f "${LAUNCHER}/bin/zowe_launcher"
54-
mkdir -p "${LAUNCHER}/bin"
51+
rm -f "${LAUNCHER_DIR}/bin/zowe_launcher"
52+
mkdir -p "${LAUNCHER_DIR}/bin"
5553

5654
GSKDIR=/usr/lpp/gskssl
5755
GSKINC="${GSKDIR}/include"
5856

59-
echo "Compiling qascii libyaml and quickjs"
57+
echo "Compiling qascii libyaml \"${LIBYAML_BRANCH}\" and quickjs \"${QUICKJS_BRANCH}\""
6058

6159
xlclang \
6260
-c \
6361
-q64 \
6462
-qascii \
6563
"-Wc,float(ieee),longname,langlvl(extc99),gonum,goff,ASM,asmlib('CEE.SCEEMAC','SYS1.MACLIB','SYS1.MODGEN')" \
66-
-DYAML_VERSION_MAJOR=${MAJOR} \
67-
-DYAML_VERSION_MINOR=${MINOR} \
68-
-DYAML_VERSION_PATCH=${PATCH} \
69-
-DYAML_VERSION_STRING="${VERSION}" \
64+
-DYAML_VERSION_MAJOR=${LIBYAML_MAJOR} \
65+
-DYAML_VERSION_MINOR=${LIBYAML_MINOR} \
66+
-DYAML_VERSION_PATCH=${LIBYAML_PATCH} \
67+
-DYAML_VERSION_STRING="\"${LIBYAML_BRANCH}\"" \
7068
-DYAML_DECLARE_STATIC=1 \
7169
-D_OPEN_SYS_FILE_EXT=1 \
7270
-D_XOPEN_SOURCE=600 \
@@ -94,7 +92,20 @@ if [ $rc -ne 0 ]; then
9492
exit 8
9593
fi
9694

97-
echo "Compiling zowe_launcher"
95+
# LAUNCHER_VERSION can be exported to specific version
96+
# However C code is expecting numbers
97+
# print $1/1 -> numeric input => numeric output, other input => "0"
98+
if [ -z "${LAUNCHER_VERSION}" ]; then
99+
LAUNCHER_VERSION=$(cat "${LAUNCHER_DIR}/manifest.yaml" | grep -e "^version:" | awk -F: '{ print $2 }')
100+
LAUNCHER_VERSION=$(echo "${LAUNCHER_VERSION}" | awk '{$1=$1};1') # awk = strip leading and trailing spaces
101+
fi
102+
if [ -n "${LAUNCHER_VERSION}" ]; then
103+
LAUNCHER_MAJOR=$(echo "${LAUNCHER_VERSION}" | awk -F. '{ print $1/1 }')
104+
LAUNCHER_MINOR=$(echo "${LAUNCHER_VERSION}" | awk -F. '{ print $2/1 }')
105+
LAUNCHER_PATCH=$(echo "${LAUNCHER_VERSION}" | awk -F. '{ print $3/1 }')
106+
fi
107+
108+
echo "Compiling zowe_launcher ${LAUNCHER_MAJOR}.${LAUNCHER_MINOR}.${LAUNCHER_PATCH}+${launcher_date_stamp}"
98109

99110
xlclang \
100111
-q64 \
@@ -107,13 +118,17 @@ xlclang \
107118
-DNOIBMHTTP=1 \
108119
-DNEW_CAA_LOCATIONS=1 \
109120
-DUSE_ZOWE_TLS=1 \
110-
-I "${LAUNCHER}/src/msg.h" \
121+
-DLAUNCHER_VERSION_MAJOR="${LAUNCHER_MAJOR}" \
122+
-DLAUNCHER_VERSION_MINOR="${LAUNCHER_MINOR}" \
123+
-DLAUNCHER_VERSION_PATCH="${LAUNCHER_PATCH}" \
124+
-DLAUNCHER_VERSION_DATE_STAMP="${launcher_date_stamp}" \
125+
-I "${LAUNCHER_DIR}/src/msg.h" \
111126
-I "${DEPS_DESTINATION}/${COMMON}/h" \
112127
-I "${DEPS_DESTINATION}/${COMMON}/platform/posix" \
113128
-I ${GSKINC} \
114129
-I "${DEPS_DESTINATION}/${LIBYAML}/include" \
115130
-I "${DEPS_DESTINATION}/${QUICKJS}" \
116-
-o "${LAUNCHER}/bin/zowe_launcher" \
131+
-o "${LAUNCHER_DIR}/bin/zowe_launcher" \
117132
api.o \
118133
reader.o \
119134
scanner.o \
@@ -128,7 +143,7 @@ xlclang \
128143
libunicode.o \
129144
libregexp.o \
130145
polyfill.o \
131-
${LAUNCHER}/src/main.c \
146+
${LAUNCHER_DIR}/src/main.c \
132147
${DEPS_DESTINATION}/${COMMON}/c/alloc.c \
133148
${DEPS_DESTINATION}/${COMMON}/c/bpxskt.c \
134149
${DEPS_DESTINATION}/${COMMON}/c/charsets.c \
@@ -174,7 +189,7 @@ fi
174189
# This program and the accompanying materials are
175190
# made available under the terms of the Eclipse Public License v2.0 which accompanies
176191
# this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html
177-
#
192+
#
178193
# SPDX-License-Identifier: EPL-2.0
179-
#
194+
#
180195
# Copyright Contributors to the Zowe Project.

build/launcher.proj.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PROJECT="launcher"
2-
VERSION=3.3.0
2+
# VERSION= used from manifest.yaml
33
DEPS="QUICKJS LIBYAML COMMON"
44

55
QUICKJS="quickjs"

src/main.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,20 @@ extern char ** environ;
7676

7777
#define YAML_ERROR_MAX 1024
7878

79+
#ifndef LAUNCHER_VERSION_MAJOR
80+
#define LAUNCHER_VERSION_MAJOR 0
81+
#endif
82+
#ifndef LAUNCHER_VERSION_MINOR
83+
#define LAUNCHER_VERSION_MINOR 0
84+
#endif
85+
#ifndef LAUNCHER_VERSION_PATCH
86+
#define LAUNCHER_VERSION_PATCH 0
87+
#endif
88+
#ifndef LAUNCHER_VERSION_DATE_STAMP
89+
#define LAUCHNER_VERSION_DATE_STAMP 0
90+
#endif
91+
char launcherVersion[40];
92+
7993
// Progressive restart internals in seconds
8094
static int restart_intervals_default[] = {1, 1, 1, 5, 5, 10, 20, 60, 120, 240};
8195

@@ -1899,9 +1913,10 @@ int main(int argc, char **argv) {
18991913
}
19001914

19011915
setenv("_BPXK_AUTOCVT", "ON", 1);
1902-
INFO(MSG_LAUNCHER_START);
1916+
sprintf(launcherVersion, "%d.%d.%d+%d", LAUNCHER_VERSION_MAJOR, LAUNCHER_VERSION_MINOR, LAUNCHER_VERSION_PATCH, LAUNCHER_VERSION_DATE_STAMP);
1917+
INFO(MSG_LAUNCHER_START, launcherVersion);
19031918
INFO(MSG_LINE_LENGTH);
1904-
printf_wto(MSG_LAUNCHER_START); // Manual sys log print (messages not set here yet)
1919+
printf_wto(MSG_LAUNCHER_START, launcherVersion); // Manual sys log print (messages not set here yet)
19051920

19061921
zl_config_t config = read_config(argc, argv);
19071922
zl_context.config = config;

src/msg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#define MSG_INST_PREPARED MSG_PREFIX "0018I" " Zowe instance prepared successfully\n"
3434
#define MSG_LAUNCHER_STOPING MSG_PREFIX "0019I" " Zowe Launcher stopping\n"
3535
#define MSG_LOADING_YAML MSG_PREFIX "0020I" " loading '%s'\n"
36-
#define MSG_LAUNCHER_START MSG_PREFIX "0021I" " Zowe Launcher starting\n"
36+
#define MSG_LAUNCHER_START MSG_PREFIX "0021I" " Zowe Launcher starting, version is %s\n"
3737
#define MSG_LAUNCHER_STOPPED MSG_PREFIX "0022I" " Zowe Launcher stopped\n"
3838
#define MSG_YAML_FILE MSG_PREFIX "0023I" " Zowe YAML config file is \'%s\'\n"
3939
#define MSG_HA_INST_ID MSG_PREFIX "0024I" " HA_INSTANCE_ID is '%s'\n"

test/config-syntax.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,19 @@
1414
print=
1515
errors=0
1616

17+
# Get the launchers's version from manifest.yaml
18+
VERSION=$(cat "../manifest.yaml" | grep -e "^version:" | awk -F: '{ print $2 }' | awk '{$1=$1};1')
19+
1720
if [ ! -z "${1}" ]; then
1821
print='1'
1922
fi
2023

2124
LAUNCHER='../bin/zowe_launcher'
25+
if [ ! -f "${LAUNCHER}" ]; then
26+
echo "Executable for Zowe launcher not found at: ${LAUNCHER}"
27+
exit 255
28+
fi
29+
2230
ABS_PATH=$(cd .; pwd)
2331

2432
TEST_FILES='./files'
@@ -77,8 +85,8 @@ done <<EOF
7785
CONFIG | HA-INSTANCE | TEXT-TO-FIND | DESCRIPTION | ZLDEBUG
7886
| | PANIC! readJson got null pathElement | No config leads to PANIC!
7987
FILE(${ZOWE_EMPTY}) | | ZWEL0318E - failed to get root node in YAML | Empty config leads to ZWEL0318E
80-
${ABS_ZOWE} | | ZWEL0021I Zowe Launcher starting | Check the basic message ZWEL0021I
81-
${ZOWE} | | INFO ZWEL0023I Zowe YAML config file is 'FILE(${ZOWE})' | ZWEL0023I wrapped by FILE()
88+
${ABS_ZOWE} | | ZWEL0021I Zowe Launcher starting, version is ${VERSION}+ | Check the basic message ZWEL0021I
89+
${ZOWE} | | INFO ZWEL0023I Zowe YAML config file is '${ZOWE}' | ZWEL0023I
8290
FILE(${ZOWE}) | | INFO ZWEL0023I Zowe YAML config file is 'FILE(${ZOWE})' | Same as previous test
8391
${ABS_ZOWE} | | INFO ZWEL0023I Zowe YAML config file is 'FILE(${ABS_ZOWE})' | ZWEL0023I wrapped by FILE()
8492
${ABS_ZOWE2} | | INFO ZWEL0023I Zowe YAML config file is 'FILE(${ABS_ZOWE2})' | Should be able to read the file

0 commit comments

Comments
 (0)