Skip to content

Commit

Permalink
tw filebeat - new docker image (dmwm#8576)
Browse files Browse the repository at this point in the history
* tw filebeat - new docker image

* tw filebeat - build image only on release

* tw filebeat - do not deploy with runcontainer.sh
  • Loading branch information
mapellidario authored Aug 2, 2024
1 parent 1967a58 commit 341db53
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
38 changes: 37 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ build_monit_image:
rules:
- if: $SUBMIT_STATUS_TRACKING
when: never
- !reference [.default_rules, default]
- !reference [.default_rules, release]
stage: build_docker
needs: ["build_tw_image"]
Expand All @@ -127,6 +126,29 @@ build_monit_image:
- src/python/TaskWorker/__init__.py
policy: pull

build_crabtwfilebeat_image:
rules:
- if: $SUBMIT_STATUS_TRACKING
when: never
- !reference [.default_rules, release]
stage: build_docker
image:
name: gcr.io/kaniko-project/executor:v1.14.0-debug
entrypoint: [""]
script:
- echo "{\"auths\":{\"$CMSCRAB_REGISTRY_URL\":{\"auth\":\"$(echo -n $CMSCRAB_REGISTRY_USER:$CMSCRAB_REGISTRY_PASSWORD | base64)\"}}}" > /kaniko/.docker/config.json
- cat /kaniko/.docker/config.json
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/cicd/filebeat/Dockerfile"
--destination "registry.cern.ch/cmscrab/crabtwfilebeat:${IMAGE_TAG}"
--build-arg "BASE_TAG=${IMAGE_TAG}"
cache:
- key: $CI_PIPELINE_ID
paths:
- src/python/TaskWorker/__init__.py
policy: pull

deploy_server:
rules:
- if: $SKIP_DEPLOY || $FORCE_RELEASE || $SUBMIT_STATUS_TRACKING
Expand Down Expand Up @@ -273,3 +295,17 @@ tag_monit_latest:
script:
- crane auth login -u ${CMSCRAB_REGISTRY_USER} -p ${CMSCRAB_REGISTRY_PASSWORD} ${CMSCRAB_REGISTRY_URL}
- crane cp registry.cern.ch/cmscrab/crabtaskworker:${IMAGE_TAG}.monit registry.cern.ch/cmscrab/crabtaskworker:v3.latest.monit

tag_filebeat_latest:
rules:
- !reference [.default_rules, release]
stage: tagging_release
image:
name: registry.cern.ch/cmscrab/buildtools
entrypoint: [""]
variables:
GIT_STRATEGY: none
script:
- crane auth login -u ${CMSCRAB_REGISTRY_USER} -p ${CMSCRAB_REGISTRY_PASSWORD} ${CMSCRAB_REGISTRY_URL}
- crane cp registry.cern.ch/cmscrab/crabtwfilebeat:${IMAGE_TAG} registry.cern.ch/cmscrab/crabtwfilebeat:v3.latest

28 changes: 28 additions & 0 deletions cicd/filebeat/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# build:
# cd CRABServer
# docker build -t filebeat-126-(date +%s) --file cicd/filebeat/Dockerfile .

FROM debian:12-slim

RUN apt update &&\
apt install -y wget gnupg tini && \
apt clean all


# install filebeat
RUN wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add - && \
apt-get install apt-transport-https && \
echo "deb https://artifacts.elastic.co/packages/oss-8.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-8.x.list && \
apt-get update && apt-get install filebeat && \
apt-get clean all

# user config
ENV USER=crab3
RUN useradd -m ${USER}
# for debuggin purpose
USER ${USER}

ENTRYPOINT ["tini", "--"]
CMD [ "/usr/share/filebeat/bin/filebeat", "--path.home", "/tmp/filebeat", \
"-c", "/data/hostdisk/filebeat-crabtwfilebeat.yaml" ]

0 comments on commit 341db53

Please sign in to comment.