Skip to content

Commit b595fdb

Browse files
authored
Add transformation test make target and docs (#1722)
Signed-off-by: braydonk <[email protected]>
1 parent a7f130b commit b595fdb

File tree

49 files changed

+801
-48
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+801
-48
lines changed

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
# Ignore a file actually called Makefile. The presence of this file interferes
2+
# with our Linux package building processes. To make a local symlink called
3+
# "Makefile" for development convenience, use this command:
4+
# make -f tasks.mak makefile_symlink
15
Makefile
26

37
# Ignore generated credentials from google-github-actions/auth
48
gha-creds-*.json
59

6-
.vscode/launch.json
10+
# This is a folder used to hold local builds of fluent-bit and otelopscol
11+
# when running transformation tests locally.
12+
dist/
13+
14+
.vscode/launch.json

builds/agent_wrapper.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
#!/bin/bash
2+
# Copyright 2024 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
216
set -x -e
317
DESTDIR=$1
418
mkdir -p "$DESTDIR/opt/google-cloud-ops-agent/libexec"

builds/fluent_bit.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
#!/bin/bash
2+
# Copyright 2024 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
216
set -x -e
317
DESTDIR=$1
418
mkdir -p $DESTDIR

builds/ops_agent_diagnostics.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
#!/bin/bash
2+
# Copyright 2024 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
216
set -x -e
317
DESTDIR=$1
418
mkdir -p "$DESTDIR/opt/google-cloud-ops-agent/libexec"

builds/otel.sh

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,51 @@
11
#!/bin/bash
2+
# Copyright 2024 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
216
set -x -e
3-
DESTDIR=$1
17+
418
otel_dir=/opt/google-cloud-ops-agent/subagents/opentelemetry-collector
5-
DESTDIR="${DESTDIR}${otel_dir}"
6-
7-
cd submodules/opentelemetry-java-contrib
8-
mkdir -p "$DESTDIR"
9-
./gradlew --no-daemon -Djdk.lang.Process.launchMechanism=vfork :jmx-metrics:build
10-
cp jmx-metrics/build/libs/opentelemetry-jmx-metrics-*-alpha-SNAPSHOT.jar "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar"
11-
12-
# Rename LICENSE file because it causes issues with file hash consistency due to an unknown
13-
# issue with the debuild/rpmbuild processes. Something is unzipping the jar in a case-insensitive
14-
# environment and having a conflict between the LICENSE file and license/ directory, leading to a changed jar file
15-
mkdir ./META-INF
16-
unzip -j "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar" "META-INF/LICENSE" -d ./META-INF
17-
zip -d "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar" "META-INF/LICENSE"
18-
mv ./META-INF/LICENSE ./META-INF/LICENSE.renamed
19-
zip -u "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar" "META-INF/LICENSE.renamed"
20-
21-
cd ../opentelemetry-operations-collector
22-
# Using array assignment to drop the filename from the sha256sum output
23-
JAR_SHA_256=($(sha256sum "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar"))
24-
go build -tags=gpu -buildvcs=false -o "$DESTDIR/otelopscol" \
25-
-ldflags "-X github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jmxreceiver.MetricsGathererHash=$JAR_SHA_256" \
26-
./cmd/otelopscol
19+
DESTDIR="${1}${otel_dir}"
20+
21+
mkdir -p $DESTDIR
22+
23+
LDFLAGS=""
24+
25+
# If this is not a local build, then we build otel java and add it to
26+
# the ldflags.
27+
if [ "$SKIP_OTEL_JAVA" != "true" ]; then
28+
cd submodules/opentelemetry-java-contrib
29+
30+
mkdir -p "$DESTDIR"
31+
./gradlew --no-daemon -Djdk.lang.Process.launchMechanism=vfork :jmx-metrics:build
32+
cp jmx-metrics/build/libs/opentelemetry-jmx-metrics-*-alpha-SNAPSHOT.jar "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar"
33+
34+
# Rename LICENSE file because it causes issues with file hash consistency due to an unknown
35+
# issue with the debuild/rpmbuild processes. Something is unzipping the jar in a case-insensitive
36+
# environment and having a conflict between the LICENSE file and license/ directory, leading to a changed jar file
37+
mkdir ./META-INF
38+
unzip -j "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar" "META-INF/LICENSE" -d ./META-INF
39+
zip -d "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar" "META-INF/LICENSE"
40+
mv ./META-INF/LICENSE ./META-INF/LICENSE.renamed
41+
zip -u "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar" "META-INF/LICENSE.renamed"
42+
43+
# Using array assignment to drop the filename from the sha256sum output
44+
JAR_SHA_256=($(sha256sum "$DESTDIR/opentelemetry-java-contrib-jmx-metrics.jar"))
45+
LDFLAGS="-X github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jmxreceiver.MetricsGathererHash=$JAR_SHA_256"
46+
47+
cd ../..
48+
fi
49+
50+
cd submodules/opentelemetry-operations-collector
51+
go build -tags=gpu -buildvcs=false -o "$DESTDIR/otelopscol" -ldflags "$LDFLAGS" ./cmd/otelopscol

builds/systemd.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
#!/bin/bash
2+
# Copyright 2024 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
216
set -x -e
317
DESTDIR=$1
418

cloudbuild/new-distro-detector/run.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
#!/bin/bash
2+
# Copyright 2024 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
216

317
# See go/sdi-new-distro-detector for details on how this script is being used.
418
# A short summary is that it is run periodically by GCB to file bugs when

cmd/agent_wrapper/main_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright 2024 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
package main
216

317
import (

confgenerator/feature_tracking_internal_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright 2024 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
package confgenerator
216

317
import (

dev-docs/makefile.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ The Makefile `tasks.mak` is a Makefile for the project that is used to quickly p
66

77
We are unable to use the actual `Makefile` name in this repo; because we build the Ops Agent into a deb package, `debhelper` tries to autodetect `make` as the build system in most of its `dh_auto` steps. We do not want `debhelper` to pick up the Makfile and try picking up different targets to build and test it.
88

9+
## Disclaimer
10+
11+
`tasks.mak` is provided without any guarantees or warranty on its targets. It is meant purely for developer convenience, and it is advised not to make any dependency on the targets since they are subject to change at any time.
12+
913
## Usage
1014

1115
For convenience it helps to make a symlink from `Makefile` to `tasks.mak` . There is a target to do this, to run it:
1216
```
1317
make -f tasks.mak makefile_symlink
1418
```
1519

16-
Now you can call the targets simply with the `make` command without needing to specify the `tasks.mak` file. The file `Makefile` is gitignored, since we don't want to push it to the repo for the reasons stated in the previous section.
20+
Now you can call the targets simply with the `make` command without needing to specify the `tasks.mak` file. The file `Makefile` is gitignored, since we don't want to push it to the repo for the reasons stated in the previous section.
1721

1822
To run something from the Makefile, you will need to give `make` the `-f` (file) flag with a path to `tasks.mak`. For example, to run the `test` target:
1923
```
@@ -35,8 +39,4 @@ A new target should be added to `tasks.mak` if:
3539
* There's a new package with Unit Tests
3640
* There is something that developers may need to run often, especially if it's a complicated command
3741
* There are new tasks to run in CI
38-
* There is a new development tool to be installed and used
39-
40-
## Disclaimer
41-
42-
`tasks.mak` is provided without any guarantees or warranty on its targets. It is meant purely for developer convenience, and it is advised not to make any dependency on the targets since they are subject to change at any time.
42+
* There is a new development tool to be installed and used

0 commit comments

Comments
 (0)