Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Moritz Sanft <[email protected]>
  • Loading branch information
msanft committed Sep 6, 2023
1 parent 41eb544 commit 594fc9b
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 13 deletions.
14 changes: 2 additions & 12 deletions .github/workflows/build-logcollector-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,5 @@ jobs:
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}

- name: Build and upload Logstash container image
uses: ./.github/actions/build_micro_service
with:
name: logstash-debugd
dockerfile: debugd/logstash/Dockerfile
githubToken: ${{ secrets.GITHUB_TOKEN }}

- name: Build and upload Filebeat container image
uses: ./.github/actions/build_micro_service
with:
name: filebeat-debugd
dockerfile: debugd/filebeat/Dockerfile
githubToken: ${{ secrets.GITHUB_TOKEN }}
shell: bash

30 changes: 30 additions & 0 deletions .github/workflows/build-test-containers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build E2E test containers

on:
workflow_dispatch:
push:
branches:
- main
paths:
- "debugd/filebeat/**"
- "debugd/logstash/**"
- "hack/logcollector/internal/templates/**"
- ".github/workflows/build-logcollector-images.yml"

jobs:
build-logcollector-debugd-images:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Check out repository
id: checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}

- name: Check CLI version
shell: bash
run: |
39 changes: 38 additions & 1 deletion e2e/malicious-join/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
load("@com_github_ash2k_bazel_tools//multirun:def.bzl", "multirun")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("//bazel/sh:def.bzl", "sh_template")

go_library(
name = "malicious-join_lib",
Expand Down Expand Up @@ -44,8 +46,43 @@ oci_image(
visibility = ["//visibility:public"],
)

genrule(
name = "malicious-join-test_repotag",
srcs = [
"//bazel/settings:tag",
],
outs = ["repotag.txt"],
cmd = "echo -n 'ghcr.io/edgelesssys/malicious-join-test:' | cat - $(location //bazel/settings:tag) > $@",
visibility = ["//visibility:public"],
)

oci_push(
name = "malicious-join_push",
image = ":malicious-join_image",
repotags = ["ghcr.io/edgelesssys/malicious-join-test:latest"],
repotags = ":repotag.txt",
)

sh_template(
name = "template_job",
data = [
"job.yaml",
":repotag.txt",
"@yq_toolchains//:resolved_toolchain",
],
substitutions = {
"@@TEMPLATE@@": "$(rootpath :job.yaml)",
"@@YQ_BIN@@": "$(rootpath @yq_toolchains//:resolved_toolchain)",
"@@REPO_TAG@@": "$(rootpath :repotag.txt)",
},
template = "test.sh.in",
visibility = ["//visibility:public"],
)

multirun(
name = "stamp_and_push",
commands = [
":template_job",
":malicious-join_push",
],
visibility = ["//visibility:public"],
)
13 changes: 13 additions & 0 deletions e2e/malicious-join/test.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
YQ=$(realpath @@YQ_BIN@@)
TEMPLATE=$(realpath @@TEMPLATE@@)
export REPO_TAG=$(realpath @@REPO_TAG@@)

cd "${BUILD_WORKING_DIRECTORY}"

if [[ $# -eq 0 ]]; then
workdir="."
else
workdir="$1"
fi

$YQ eval ".spec.template.spec.containers[0].image |= \"ghcr.io/edgelesssys/malicious-join-test:\" + load_str(strenv(REPO_TAG))" $TEMPLATE > stamped_job.yaml

0 comments on commit 594fc9b

Please sign in to comment.