Skip to content

Commit

Permalink
Merge branch 'main' into codeboten/fix-sec-warnings-4
Browse files Browse the repository at this point in the history
  • Loading branch information
codeboten authored Dec 23, 2024
2 parents a221ffb + 14f37f1 commit 2c10d29
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 42 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/api-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ on:
branches:
- main

permissions:
contents: read
permissions: read-all

jobs:
Check-Compatibility:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/build-and-test-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ env:
# We limit cache download as a whole to 5 minutes.
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2

permissions:
contents: read
permissions: read-all

# Do not cancel this workflow on main. See https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/16616
concurrency:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/build-and-test-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

permissions:
contents: read
permissions: read-all

jobs:
windows-unittest:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ on:
types: [checks_requested]
pull_request:

permissions:
contents: read
permissions: read-all

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/builder-integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ on:

# manual execution
workflow_dispatch:

merge_group:
types: [checks_requested]

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

permissions:
contents: read
permissions: read-all

jobs:
integration-test:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

permissions:
contents: read
permissions: read-all

jobs:
changelog:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/check-links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

permissions:
contents: read
permissions: read-all

jobs:
changedfiles:
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/check-merge-freeze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@ name: Merge freeze

on:
pull_request:
types: [opened, ready_for_review, synchronize, reopened, labeled, unlabeled, enqueued]
types:
[
opened,
ready_for_review,
synchronize,
reopened,
labeled,
unlabeled,
enqueued,
]
branches: [main]
merge_group:
types: [checks_requested]

permissions: read-all

jobs:
check-merge-freeze:
name: Check
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

permissions:
contents: read
permissions: read-all

jobs:
CodeQL-Build:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/contrib-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

permissions:
contents: read
permissions: read-all

jobs:
contrib-tests-matrix:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/generate-semantic-conventions-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ on:
- cron: "30 1 * * *"
workflow_dispatch:

permissions:
contents: read
permissions: read-all

jobs:
check-versions:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/milestone-add-to-pr.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# This action adds the "next release" milestone to a pull request
# when it is merged

name: 'Project: Add PR to Milestone'
name: "Project: Add PR to Milestone"
on:
pull_request_target:
types:
- closed

permissions: read-all

jobs:
update-pr:
if: github.event.pull_request.merged
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ on:
push:
branches: [main]

permissions:
contents: read
permissions: read-all

jobs:
runperf:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
name: Shellcheck lint
on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
merge_group:
types: [checks_requested]

permissions:
contents: read
permissions: read-all

jobs:
shellcheck:
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/stale-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@ on:
schedule:
- cron: "12 3 * * *" # arbitrary time not to DDOS GitHub

permissions:
contents: read
permissions: read-all

jobs:
stale:
permissions:
issues: write # for actions/stale to close stale issues
pull-requests: write # for actions/stale to close stale PRs
issues: write # for actions/stale to close stale issues
pull-requests: write # for actions/stale to close stale PRs
runs-on: ubuntu-latest
steps:
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-pr-message: 'This PR was marked stale due to lack of activity. It will be closed in 14 days.'
close-pr-message: 'Closed as inactive. Feel free to reopen if this PR is still being worked on.'
stale-pr-message: "This PR was marked stale due to lack of activity. It will be closed in 14 days."
close-pr-message: "Closed as inactive. Feel free to reopen if this PR is still being worked on."
days-before-pr-stale: 14
days-before-issue-stale: 730
days-before-pr-close: 14
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/tidy-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ on:
branches:
- main

permissions:
contents: read
permissions: read-all

jobs:
setup-environment:
Expand Down
39 changes: 34 additions & 5 deletions docs/coding-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,40 @@ When naming configuration structs, use the following guidelines:
- Use the `Settings` suffix for configuration structs that are set by developers in the code. For example, `component.TelemetrySettings` ends in `Settings` since it is set by developers in the code.
- Avoid redundant prefixes that are already implied by the package name. For example, use`configgrpc.ClientConfig` instead of `configgrpc.GRPCClientConfig`.

#### Experimental module naming

Experimental modules can be introduced as submodules of stable modules. They MUST have the same name as the stable
modules prefixed with `x`. For example, `config/confighttp` module can have an experimental module named
`config/confighttp/xconfighttp` that contains experimental APIs.
### Module organization

As usual in Go projects, organize your code into packages grouping related functionality. To ensure
that we can evolve different parts of the API independently, you should also group related packages
into modules.

We use the following rules for some common situations where we split into separate modules:
1. Each top-level directory should be a separate module.
1. Each component referenceable by the OpenTelemetry Collector Builder should be in a separate
module. For example, the OTLP receiver is in its own module, different from that of other
receivers.
1. Consider splitting into separate modules if the API may evolve independently in separate groups
of packages. For example, the configuration related to HTTP and gRPC evolve independently, so
`config/configgrpc` and `config/confighttp` are separate modules.
1. Testing helpers should be in a separate submodule with the suffix `test`. For example, if you
have a module `component`, the helpers should be in `component/componenttest`.
1. Experimental packages that will later be added to another module should be in their own module,
named as they will be after integration. For example, if adding a `pprofile` package to `pdata`,
you should add a separate module `pdata/pprofile` for the experimental code.
1. Experimental code that will be added to an existing package in a stable module can be a submodule
with the same name, but prefixed with an `x`. For example, `config/confighttp` module can have an
experimental module named `config/confighttp/xconfighttp` that contains experimental APIs.

When adding a new module remember to update the following:
1. Add a changelog note for the new module.
1. Add the module in `versions.yaml`.
1. Use `make crosslink` to make sure the module replaces are added correctly throughout the
codebase. You may also have to manually add some of the replaces.
1. Update the [otelcorecol
manifest](https://github.com/open-telemetry/opentelemetry-collector/blob/main/cmd/otelcorecol/builder-config.yaml)
and [builder
tests](https://github.com/open-telemetry/opentelemetry-collector/blob/main/cmd/builder/internal/builder/main_test.go).
1. Open a follow up PR to update pseudo-versions in all go.mod files. See [this example
PR](https://github.com/open-telemetry/opentelemetry-collector/pull/11668).

### Enumerations

Expand Down

0 comments on commit 2c10d29

Please sign in to comment.