-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for metadata for job runs #208
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) | |
set(CMAKE_CXX_STANDARD 17) | ||
|
||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-declarations" ) | ||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Werror -DDEBUG") | ||
|
||
# Allow passing in the version string, for e.g. patched/packaged versions | ||
|
@@ -142,6 +143,7 @@ set(LAMINARD_CORE_SOURCES | |
src/run.cpp | ||
src/server.cpp | ||
src/version.cpp | ||
src/json.cpp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it is necessary to break this out into a separate file - see later comments for explanation |
||
laminar.capnp.c++ | ||
index_html_size.h | ||
) | ||
|
@@ -206,4 +208,4 @@ if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") | |
install(FILES etc/laminar.conf DESTINATION ${CMAKE_INSTALL_PREFIX}/etc) | ||
configure_file(etc/laminar.service.in laminar.service @ONLY) | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/laminar.service DESTINATION ${CMAKE_INSTALL_PREFIX}${SYSTEMD_UNITDIR}) | ||
endif() | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -494,6 +494,22 @@ TIMEOUT=120 | |
|
||
--- | ||
|
||
# Adding metadata to runs | ||
|
||
With the `laminarc tag` command the build scripts can augment runs with metadata. | ||
This can be SCM-oriented information like the used branch or release-version. | ||
The metadata is a list of key/value pairs. | ||
The metadata is automatically shown in the run-view of a job in the web UI. | ||
|
||
Each call of `laminarc tag` can assign one key/value pair. | ||
|
||
Example: | ||
``` | ||
laminarc tag $JOBNAME $NUMBER Branch "$(git -C $WORKSPACE branch --show-current)" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we only intend this to be called from within the run, |
||
``` | ||
|
||
--- | ||
|
||
# Contexts | ||
|
||
In Laminar, each run of a job is associated with a context. The context defines an integer number of *executors*, which is the amount of runs which the context will accept simultaneously. A context may also provide additional environment variables. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ VERSION=$(cd "$SOURCE_DIR" && git describe --tags --abbrev=8 --dirty)-1~upstream | |
|
||
DOCKER_TAG=$(docker build -q - <<EOS | ||
FROM debian:11-slim | ||
RUN apt-get update && apt-get install -y wget cmake g++ capnproto libcapnp-dev rapidjson-dev libsqlite3-dev libboost-dev zlib1g-dev | ||
RUN apt-get update && apt-get install -y wget cmake g++ capnproto libcapnp-dev rapidjson-dev libsqlite3-dev libboost-dev zlib1g-dev pkg-config | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
EOS | ||
) | ||
|
||
|
@@ -34,6 +34,8 @@ Depends: libcapnp-0.7.0, libsqlite3-0, zlib1g | |
Description: Lightweight Continuous Integration Service | ||
EOF | ||
echo /etc/laminar.conf > laminar/DEBIAN/conffiles | ||
mkdir -p laminar/etc | ||
mv laminar/usr/etc/laminar.conf laminar/etc/laminar.conf | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is a bug introduced elsewhere and this is not the right place to fix it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed here 8c3d7f6 |
||
cat <<EOF > laminar/DEBIAN/postinst | ||
#!/bin/bash | ||
echo Creating laminar user with home in /var/lib/laminar | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/// | ||
/// Copyright 2015-2022 Oliver Giles | ||
/// | ||
/// This file is part of Laminar | ||
/// | ||
/// Laminar is free software: you can redistribute it and/or modify | ||
/// it under the terms of the GNU General Public License as published by | ||
/// the Free Software Foundation, either version 3 of the License, or | ||
/// (at your option) any later version. | ||
/// | ||
/// Laminar is distributed in the hope that it will be useful, | ||
/// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
/// GNU General Public License for more details. | ||
/// | ||
/// You should have received a copy of the GNU General Public License | ||
/// along with Laminar. If not, see <http://www.gnu.org/licenses/> | ||
/// | ||
#include "json.h" | ||
|
||
template<> Json& Json::set(const char* key, double value) { String(key); Double(value); return *this; } | ||
template<> Json& Json::set(const char* key, const char* value) { String(key); String(value); return *this; } | ||
template<> Json& Json::set(const char* key, std::string value) { String(key); String(value.c_str()); return *this; } | ||
|
||
Json& Json::setJsonObject(const char* key, const std::string& object) | ||
{ | ||
String(key); | ||
if( object.length() ) | ||
{ | ||
RawValue(object.c_str(), object.length(), rapidjson::kObjectType); | ||
} | ||
else | ||
{ | ||
StartObject(); | ||
EndObject(); | ||
} | ||
return *this; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/// | ||
/// Copyright 2015-2022 Oliver Giles | ||
/// | ||
/// This file is part of Laminar | ||
/// | ||
/// Laminar is free software: you can redistribute it and/or modify | ||
/// it under the terms of the GNU General Public License as published by | ||
/// the Free Software Foundation, either version 3 of the License, or | ||
/// (at your option) any later version. | ||
/// | ||
/// Laminar is distributed in the hope that it will be useful, | ||
/// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
/// GNU General Public License for more details. | ||
/// | ||
/// You should have received a copy of the GNU General Public License | ||
/// along with Laminar. If not, see <http://www.gnu.org/licenses/> | ||
/// | ||
#ifndef LAMINAR_JSON_H_ | ||
#define LAMINAR_JSON_H_ | ||
|
||
#include <rapidjson/stringbuffer.h> | ||
#include <rapidjson/writer.h> | ||
#include <string> | ||
|
||
// rapidjson::Writer with a StringBuffer is used a lot in Laminar for | ||
// preparing JSON messages to send to HTTP clients. A small wrapper | ||
// class here reduces verbosity later for this common use case. | ||
class Json : public rapidjson::Writer<rapidjson::StringBuffer> { | ||
public: | ||
Json() : rapidjson::Writer<rapidjson::StringBuffer>(buf) { StartObject(); } | ||
template<typename T> | ||
Json& set(const char* key, T value) { String(key); Int64(value); return *this; } | ||
Json& startObject(const char* key) { String(key); StartObject(); return *this; } | ||
Json& startArray(const char* key) { String(key); StartArray(); return *this; } | ||
Json& setJsonObject(const char* key, const std::string& object); | ||
const char* str() { EndObject(); return buf.GetString(); } | ||
private: | ||
rapidjson::StringBuffer buf; | ||
}; | ||
|
||
template<> Json& Json::set(const char* key, double value); | ||
template<> Json& Json::set(const char* key, const char* value); | ||
template<> Json& Json::set(const char* key, std::string value); | ||
|
||
|
||
#endif // ? ! LAMINAR_LAMINAR_H_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What caused this? If it is not related to this change it should be dealt with separately. Also consider that only
Debug
builds get-Werror
, so if this is really needed then it should be put inCMAKE_CXX_FLAGS_DEBUG