Version 2023.2-1, new Deno and Node, PHP fix, admin versions generator
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Adam Štrauch 2023-02-03 17:46:51 +01:00
parent 631ad0c859
commit d2333b2b3a
Signed by: cx
GPG key ID: 018304FFA8988F8D
5 changed files with 54 additions and 182 deletions

View file

@ -48,7 +48,9 @@ ADD build_node.sh /usr/local/bin/build_node.sh
RUN build_node.sh 16.19.0 RUN build_node.sh 16.19.0
RUN build_node.sh 17.9.1 RUN build_node.sh 17.9.1
RUN build_node.sh 18.12.1 RUN build_node.sh 18.12.1
RUN build_node.sh 18.14.0
RUN build_node.sh 19.3.0 RUN build_node.sh 19.3.0
RUN build_node.sh 19.6.0
## Python ## Python
WORKDIR /usr/src WORKDIR /usr/src
@ -63,6 +65,7 @@ ADD build_php8.sh /usr/local/bin/build_php8.sh
# 2022/12 # 2022/12
RUN build_php8.sh 8.1.13 RUN build_php8.sh 8.1.13
RUN build_php8.sh 8.2.0 RUN build_php8.sh 8.2.0
RUN build_php8.sh 8.2.1
## Ruby ## Ruby
WORKDIR /usr/src WORKDIR /usr/src
@ -75,6 +78,7 @@ RUN build_ruby.sh 3.2.0
ADD build_deno.sh /usr/local/bin/build_deno.sh ADD build_deno.sh /usr/local/bin/build_deno.sh
# 2022/12 # 2022/12
RUN build_deno.sh 1.29.1 RUN build_deno.sh 1.29.1
RUN build_deno.sh 1.30.1
############# #############

View file

@ -1,21 +1,26 @@
REPO=harbor.hq.rosti.cz/rosti/runtime REPO=harbor.hq.rosti.cz/rosti/runtime
DOCKER=docker DOCKER=docker
VERSION=2023.01-1 VERSION=2023.02-1
BASEIMAGE=debian:11
all: build all: build
build: build:
$(DOCKER) pull debian:11 $(DOCKER) pull ${BASEIMAGE}
$(DOCKER) build -t ${REPO}:dev . $(DOCKER) build -t ${REPO}:dev .
$(DOCKER) tag ${REPO}:dev ${REPO}:$(VERSION) $(DOCKER) tag ${REPO}:dev ${REPO}:$(VERSION)
@echo "JSON for admin:"
python generate_versions.py
test: test:
DOCKER=$(DOCKER) bash ./tests2.sh ${REPO}:$(VERSION) DOCKER=$(DOCKER) bash ./tests2.sh ${REPO}:$(VERSION)
squashed: squashed:
$(DOCKER) pull debian:11 $(DOCKER) pull ${BASEIMAGE}
$(DOCKER) build --squash -t ${REPO}:dev-squashed . $(DOCKER) build --squash -t ${REPO}:dev-squashed .
$(DOCKER) tag ${REPO}:dev-squashed ${REPO}:$(VERSION) $(DOCKER) tag ${REPO}:dev-squashed ${REPO}:$(VERSION)
@echo "JSON for admin:"
python generate_versions.py
push: squashed push: squashed
$(DOCKER) push ${REPO}:$(VERSION) $(DOCKER) push ${REPO}:$(VERSION)

38
generate_versions.py Normal file
View file

@ -0,0 +1,38 @@
#!/usr/bin/env python
import json
import os
import subprocess
output = {
"techs": {},
"system": {
"distro": "debian",
"version": "11.6",
}
}
image = ""
with open("Dockerfile") as f:
lines = f.readlines()
for line in lines:
if line.startswith("FROM debian:"):
image = line.split(" ")[1].strip()
continue
if line.startswith("RUN build_"):
parts = line.split(" ")
name = parts[1].replace("build_", "").replace(".sh", "")
if name.startswith("php"):
name = "php"
version = line.split(" ")[2].strip()
if name not in output["techs"]:
output["techs"][name] = {
"versions": [],
}
output["techs"][name]["versions"].append(version)
# os.system(f"docker pull {image}")
system_version = subprocess.check_output(f"podman run --rm {image} cat /etc/debian_version", shell=True)
output["system"]["version"] = system_version.strip().decode()
print(json.dumps(output, indent=4))

View file

@ -4,10 +4,11 @@
# DEFAULT VERSIONS # DEFAULT VERSIONS
VERSION_PYTHON=3.11.1 VERSION_PYTHON=3.11.1
VERSION_PHP=8.2.0 VERSION_PHP=8.2.1
VERSION_NODE=18.12.1 VERSION_NODE=18.14.0
VERSION_RUBY=3.2.0 VERSION_RUBY=3.2.0
VERSION_DENO=1.29.1 VERSION_DENO=1.29.1
VERSION_DENO=1.30.1
WIDTH=180 WIDTH=180
HEIGHT=25 HEIGHT=25
@ -85,7 +86,7 @@ function setTech() {
# And remove unneeded ones # And remove unneeded ones
# TODO: not sure how good idea this is # TODO: not sure how good idea this is
rm -f /srv/app/php-fpm.conf /srv/app/pool_app.conf /srv/app/php.ini /srv/app/nginx.conf rm -f /srv/app/php-fpm.conf /srv/app/pool_app.conf /srv/app/php.ini
fi fi
# Node specific stuff # Node specific stuff

176
tests.sh
View file

@ -1,176 +0,0 @@
#!/bin/bash
if [ -z "$DOCKER" ]; then
DOCKER=docker
fi
CONTAINER_NAME=runtime-test
I=1
COUNT=9
PROBLEM=0
function run() {
$DOCKER run -d --rm --name $CONTAINER_NAME rosti/runtime:dev > /dev/null
sleep 5
}
function stop() {
$DOCKER stop $CONTAINER_NAME > /dev/null
sleep 5
}
# Default page
run
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep "<title>Roští.cz</title>" > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT default response correct"
else
echo "$I/$COUNT default response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
###############
# Node.js 12.16.1
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=node-12.16.1 $CONTAINER_NAME su app -c rosti > /dev/null
sleep 3
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep package.json > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT Node.js 12.16.1 response correct"
else
echo "$I/$COUNT Node.js 12.16.1 response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
# Node.js 12.18.3
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=node-12.18.3 $CONTAINER_NAME su app -c rosti > /dev/null
sleep 3
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep package.json > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT Node.js 12.18.3 response correct"
else
echo "$I/$COUNT Node.js 12.18.3 response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
###############
# Node.js 13.7.0
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=node-13.7.0 $CONTAINER_NAME su app -c rosti > /dev/null
sleep 3
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep package.json > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT Node.js 13.7.0 response correct"
else
echo "$I/$COUNT Node.js 13.7.0 response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
# Node.js 14.8.0
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=node-14.8.0 $CONTAINER_NAME su app -c rosti > /dev/null
sleep 3
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep package.json > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT Node.js 14.8.0 response correct"
else
echo "$I/$COUNT Node.js 14.8.0 response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
###############
# Python 3.8.2
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=python-3.8.2 $CONTAINER_NAME su app -c rosti > /dev/null
sleep 5
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep "app.py" > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT Python 3.8.2 response correct"
else
echo "$I/$COUNT Python 3.8.2 response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
# Python 3.8.5
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=python-3.8.5 $CONTAINER_NAME su app -c rosti > /dev/null
sleep 5
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep "app.py" > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT Python 3.8.5 response correct"
else
echo "$I/$COUNT Python 3.8.5 response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
###############
# PHP 7.4.4
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=php-7.4.4 $CONTAINER_NAME su app -c rosti > /dev/null
sleep 5
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep "PHP aplikaci" > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT PHP 7.4.4 response correct"
else
echo "$I/$COUNT PHP 7.4.4 response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
# PHP 7.4.9
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=php-7.4.9 $CONTAINER_NAME su app -c rosti > /dev/null
sleep 5
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep "PHP aplikaci" > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT PHP 7.4.9 response correct"
else
echo "$I/$COUNT PHP 7.4.9 response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
###############
if [ "$PROBLEM" = "0" ]; then
echo
echo "All OK"
exit 0
else
echo
echo "Problem found"
exit 1
fi