Skip to content
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

fix: disable logging outside of local domain (#644) #655

Open
wants to merge 5 commits into
base: SL22b
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 39 additions & 5 deletions .github/workflows/build-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
starenv: [root5, root6]
starenv: [root5]
compiler: [gcc485]
env:
STARENV: ${{ matrix.starenv }}-${{ matrix.compiler }}
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/[email protected]
uses: tj-actions/branch-names@v6

- name: Define complete image tag
run: |
echo "TAG=${{ steps.branch-name.outputs.current_branch || steps.branch-name.outputs.tag }}-${{ env.STARENV }}" >> $GITHUB_ENV

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -39,5 +43,35 @@ jobs:
build-args: |
starenv=${{ matrix.starenv }}
compiler=${{ matrix.compiler }}
push: true
tags: ghcr.io/${{ github.repository_owner }}/star-sw:${{ steps.branch-name.outputs.current_branch }}-${{ env.STARENV }}
load: true
tags: ghcr.io/${{ github.repository_owner }}/star-sw:${{ env.TAG }}

- name: Push container image
run: |
docker push ghcr.io/${{ github.repository_owner }}/star-sw:${{ env.TAG }}

- name: Create latest tag for default branch
if: ${{ steps.branch-name.outputs.is_tag == 'false' && steps.branch-name.outputs.is_default == 'true' && env.STARENV == 'root5-gcc485' }}
run: |
docker tag ghcr.io/${{ github.repository_owner }}/star-sw:${{ env.TAG }} ghcr.io/${{ github.repository_owner }}/star-sw:latest
docker push ghcr.io/${{ github.repository_owner }}/star-sw:latest

- name: Create latest tag for SL* branches
if: ${{ steps.branch-name.outputs.is_tag == 'false' && steps.branch-name.outputs.is_default == 'false' && env.STARENV == 'root5-gcc485' }}
run: |
docker tag ghcr.io/${{ github.repository_owner }}/star-sw:${{ env.TAG }} ghcr.io/${{ github.repository_owner }}/star-sw:${{ steps.branch-name.outputs.current_branch }}
docker push ghcr.io/${{ github.repository_owner }}/star-sw:${{ steps.branch-name.outputs.current_branch }}

- name: Create image tag based on pushed tag
if: ${{ steps.branch-name.outputs.is_tag == 'true' && env.STARENV == 'root5-gcc485' }}
run: |
docker tag ghcr.io/${{ github.repository_owner }}/star-sw:${{ env.TAG }} ghcr.io/${{ github.repository_owner }}/star-sw:${{ steps.branch-name.outputs.tag }}
docker push ghcr.io/${{ github.repository_owner }}/star-sw:${{ steps.branch-name.outputs.tag }}

build-cleanup:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v3
- run: .github/workflows/delete_untagged.py ${{ secrets.STAR_BNL_STAR_SW_TOKEN }}
64 changes: 52 additions & 12 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
name: Build Pull Request

on: pull_request
on:
pull_request:
paths-ignore:
- '.github/**'
- 'docs/**'
- '!.github/workflows/**'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
starenv: [root5, root6]
starenv: [root5]
compiler: [gcc485]
env:
STARENV: ${{ matrix.starenv }}-${{ matrix.compiler }}
Expand All @@ -32,14 +41,17 @@ jobs:
name: star-sw-${{ env.STARENV }}
path: /tmp/star-sw-${{ env.STARENV }}.tar

ROOT5_test:
test:
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
test_id: [29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 59, 60, 76, 77, 78, 90, 91, 92, 119, 120]
test_id: [10, 11, 22, 23, 24, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 59, 60, 76, 77, 78, 90, 91, 92, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121]
starenv: [root5]
compiler: [gcc485]
env:
STARENV: root5-gcc485
STARENV: ${{ matrix.starenv }}-${{ matrix.compiler }}
steps:
- name: Download artifact
uses: actions/download-artifact@v3
Expand All @@ -48,21 +60,23 @@ jobs:
path: /tmp

- run: docker load --input /tmp/star-sw-${{ env.STARENV }}.tar
- run: docker run --name star-test-data --volume /star ghcr.io/star-bnl/star-test-data:v2
- run: docker run --name star-test-data --volume /star ghcr.io/star-bnl/star-test-data:v7
- run: |
TEST_CMD=$(docker run --rm ghcr.io/star-bnl/star-sw-${{ env.STARENV }} tests/executest.py -c ${{ matrix.test_id }})
# Workaround https://sft.its.cern.ch/jira/browse/ROOT-7660 in ROOT 5 by checking the output log
docker run --volumes-from star-test-data ghcr.io/star-bnl/star-sw-${{ env.STARENV }} \
sh -c "set -e; MALLOC_CHECK_=3 $TEST_CMD 2>&1 | tee log; grep 'Run completed' log"

ROOT6_test_ignore_fail:
ROOT5_test_doEvents:
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
test_id: [50, 52, 54, 90, 91, 92, 119, 120]
test_id: [121, 122]
compiler: [gcc485]
env:
STARENV: root6-gcc485
STARENV: root5-${{ matrix.compiler }}
steps:
- name: Download artifact
uses: actions/download-artifact@v3
Expand All @@ -71,8 +85,34 @@ jobs:
path: /tmp

- run: docker load --input /tmp/star-sw-${{ env.STARENV }}.tar
- run: docker run --name star-test-data --volume /star ghcr.io/star-bnl/star-test-data:v2
- run: docker run --name star-test-data --volume /star ghcr.io/star-bnl/star-test-data:v7
- run: |
TEST_CMD=$(docker run --rm ghcr.io/star-bnl/star-sw-${{ env.STARENV }} tests/executest.py -c ${{ matrix.test_id }})
TEST_FILE=$(echo "$(docker run --rm ghcr.io/star-bnl/star-sw-${{ env.STARENV }} tests/executest.py ${{ matrix.test_id }} -a fullpath)" | sed -E 's/\.(daq|fzd)$/.event.root/')
TEST_CMD="root4star -b -q -l 'StRoot/macros/analysis/doEvents.C(100, \"$TEST_FILE\")'"
docker run --volumes-from star-test-data ghcr.io/star-bnl/star-sw-${{ env.STARENV }} \
sh -c "set -e; $TEST_CMD 2>&1 | tee log; grep '<StIOMaker::Finish> IO:' log"

ROOT5_test_find_vertex:
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
test_id: [102, 121, 122]
compiler: [gcc485]
env:
STARENV: root5-${{ matrix.compiler }}
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: star-sw-${{ env.STARENV }}
path: /tmp

- run: docker load --input /tmp/star-sw-${{ env.STARENV }}.tar
- run: docker run --name star-test-data --volume /star ghcr.io/star-bnl/star-test-data:v7
- run: |
TEST_FILE=$(echo "$(docker run --rm ghcr.io/star-bnl/star-sw-${{ env.STARENV }} tests/executest.py ${{ matrix.test_id }} -a fullpath)" | sed -E 's/\.(daq|fzd)$/.event.root/')
TEST_CMD="root4star -b -q -l 'StRoot/macros/analysis/find_vertex.C(\"$TEST_FILE\")'"
docker run --volumes-from star-test-data ghcr.io/star-bnl/star-sw-${{ env.STARENV }} \
sh -c "MALLOC_CHECK_=3 $TEST_CMD || echo 'Failed with an exit code: '\$?"
sh -c "set -e; $TEST_CMD 2>&1 | tee log; grep '<StIOMaker::Finish> StIO:' log"
25 changes: 25 additions & 0 deletions .github/workflows/delete_untagged.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python3

import argparse
import json
import requests
import types

parser = argparse.ArgumentParser()
parser.add_argument("token", help="GitHub token")
args = parser.parse_args()

domain = "api.github.com"
org = "star-bnl"
package_type = "container"
package_name = "star-sw"

api_url = f"https://{domain}/orgs/{org}/packages/{package_type}/{package_name}/versions"

respjson = requests.get(api_url, auth=("token", args.token))
entries = json.loads(respjson.text, object_hook=lambda d: types.SimpleNamespace(**d))

for e in entries:
if not e.metadata.container.tags:
response = requests.delete(api_url + f"/{e.id}", auth=("token", args.token))
print("delete", e.id, e.html_url, e.name, response.url, response.status_code)
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ ARG starenv=root5
# Pick one from [gcc485, gcc11]
ARG compiler=gcc485

FROM ghcr.io/star-bnl/star-spack:v0.1.6-${starenv}-${compiler}
FROM ghcr.io/star-bnl/star-spack:v0.3.0-${starenv}-${compiler}

ARG compiler

ENV NODEBUG=yes
ENV STAR=/star-sw
Expand All @@ -21,8 +23,11 @@ COPY . ${STAR}

SHELL ["/bin/bash", "-l", "-c"]

RUN cons \
&& find .$STAR_HOST_SYS -name *.o -exec rm '{}' \;
RUN <<EOF
set -e
cons
find .$STAR_HOST_SYS -name *.o -exec rm '{}' \;
EOF

COPY --chmod=0755 <<-"EOF" /opt/entrypoint.sh
#!/bin/bash -l
Expand Down
45 changes: 9 additions & 36 deletions StRoot/RTS/include/rtsLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,41 +93,14 @@ void rtsLogAddJmlFile (char *fname);



/*Tonko: not used Special (mis)handling for STAR Offline Code
#ifdef __ROOT__
#define RTS_DISABLE_LOG
#endif
*/

#ifdef RTS_DISABLE_LOG

#define RTS_ASSERT(expr) assert(expr)


#define LOG(SEV,STRING,ARGS...) \
do { \
const char *const yada = SEV ; \
if((*yada == 'E')) { \
fprintf(stderr,"" ANSI_RED "RTS_" SEV ": " __FILE__ " [line %d]: " STRING "" ANSI_RESET "\n" , __LINE__ , ##ARGS) ;\
} \
else if((*yada == 'C')) { \
fprintf(stderr,"" ANSI_RED "" ANSI_REVERSE "RTS_" SEV ": " __FILE__ " [line %d]: " STRING "" ANSI_RESET "\n" , __LINE__ , ##ARGS) ;\
} \
else if((*yada == 'I')) { \
fprintf(stderr,"" ANSI_BLUE "" ANSI_BOLD "RTS_" SEV ": " __FILE__ " [line %d]: " STRING "" ANSI_RESET "\n" , __LINE__ , ##ARGS) ;\
} \
else if((*yada == 'T')) { \
fprintf(stderr,"" ANSI_GREEN "" ANSI_BOLD "RTS_" SEV ": " __FILE__ " [line %d]: " STRING "" ANSI_RESET "\n" , __LINE__ , ##ARGS) ;\
} \
else if((*yada == 'W')) { \
fprintf(stderr,"" ANSI_CYAN "" ANSI_BOLD "RTS_" SEV ": " __FILE__ " [line %d]: " STRING "" ANSI_RESET "\n" , __LINE__ , ##ARGS) ;\
} \
else if((*yada == 'O')) { \
fprintf(stderr,"" ANSI_BLUE "" ANSI_REVERSE "RTS_" SEV ": " __FILE__ " [line %d]: " STRING "" ANSI_RESET "\n" , __LINE__ , ##ARGS) ;\
} \
} while(0) \

#ifndef RTS_ENABLE_LOG

#define RTS_ASSERT(expr) assert(expr)
#define LOG(SEV,STRING,ARGS...)
#define rtsLogUnix_v(str, ...)
#define rtsLogAddCmd(x)


// the following become noops...
Expand All @@ -136,7 +109,7 @@ void rtsLogAddJmlFile (char *fname);
#define rtsLogLevelInt(x)
#define rtsLogOutput(x)

#else /* RTS_DISABLE_LOG */
#else /* RTS_ENABLE_LOG */


#ifdef __GNUC__
Expand Down Expand Up @@ -270,12 +243,12 @@ INLINE_HACK void rtsLogLevel(const char *level)



#endif
#endif /* RTS_LOG_COLORED */

#endif
#endif /* __vxworks */


#endif /* RTS_DISABLE_LOG */
#endif /* RTS_ENABLE_LOG */

#ifdef __cplusplus
}
Expand Down
3 changes: 2 additions & 1 deletion StRoot/RTS/src/LOG/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
include ../rtsmakefile.def
include ../rtsplus.def


# zap LDLIBS
LDLIBS =

Expand All @@ -28,7 +29,7 @@ rtsLog.o : rtsLog.C

rtsLog: rtsLog.o rtsLogUnix.o
$(CXX) $(CXXFLAGS) rtsLogUnix.o rtsLog.o -o rtsLog

#operDisplay.sh:


Expand Down
2 changes: 1 addition & 1 deletion StRoot/RTS/src/LOG/rtsLog.C
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int main(int argc, char *argv[])
use_stdin = 0 ;

rtsLogLevel(DBG) ;
rtsLogOutput(RTS_LOG_NET) ;
//rtsLogOutput(RTS_LOG_NET) ;

memset(logstr,0,sizeof(logstr)) ;

Expand Down
38 changes: 32 additions & 6 deletions StRoot/RTS/src/LOG/rtsLogUnix.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,31 @@ extern "C" {
volatile int tonkoLogLevel = 2 ;


static char *getCmd(void) ;




#ifdef RTS_ENABLE_LOG
#warning "DAQ logging is enabled"
#ifdef RTS_LOG_DEFAULT_NET
#warning "DAQ logging defaults to daqman"
#else
#warning "DAQ logging defaults to STDERR"
#endif /* RTS_LOG_DEFAULT_NET */
#else
#warning "DAQ logging is disabled"
#endif /* RTS_ENABLE_LOG */


#ifdef RTS_ENABLE_LOG

#ifdef RTS_LOG_DEFAULT_NET
static int output_flag = RTS_LOG_NET ;
#else
static int output_flag = RTS_LOG_STDERR ;
#endif

static const char *getCmd(void) ;
static int odesc = -1 ;
static int handchange ;
static FILE *fdesc = 0 ;
Expand All @@ -42,7 +66,7 @@ static char servER[80] = RTS_LOG_HOST ;
#endif

static int port = RTS_LOG_PORT ;
static int output_flag = RTS_LOG_NET ;

static char cmd[1024] ;

/*
Expand Down Expand Up @@ -113,7 +137,6 @@ void rtsLogAddJmlFile (char *fname)
jml_fname = _g_fname;
}


int rtsLogUnix_v(const char *str, ...)
{
/* common to all threads */
Expand Down Expand Up @@ -328,9 +351,7 @@ int rtsLogUnix_v(const char *str, ...)
return 0 ;
}



static char *getCmd(void)
static const char *getCmd(void)
{


Expand Down Expand Up @@ -370,6 +391,11 @@ static char *getCmd(void)
#endif
}


#endif



#ifdef __cplusplus
}
#endif
Expand Down
Loading
Loading