-
Notifications
You must be signed in to change notification settings - Fork 440
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
[chore] Build and publish application hosted in the repository for the Golang instrumentation E2E test #2097
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
734a0bf
Build and publish the Golang E2E image
iblancasa 1589c8d
Merge branch 'main' into task/2073-golang
iblancasa 6754377
Merge branch 'task/2073-golang' of github.com:iblancasa/opentelemetry…
iblancasa 36c1f9c
Merge branch 'main' of github.com:open-telemetry/opentelemetry-operat…
iblancasa b2201db
Fix the CI
iblancasa 1a3cc03
Fix the tags
iblancasa 108c021
Add missing header
iblancasa 7cd4802
Merge branch 'main' into task/2073-golang
iblancasa 7bd239f
Merge branch 'main' of github.com:open-telemetry/opentelemetry-operat…
iblancasa 99fee68
Use alpine image for builder
iblancasa 849b582
Change image name
iblancasa 2d1886b
Merge branch 'task/2073-golang' of github.com:iblancasa/opentelemetry…
iblancasa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
.github/workflows/publish-autoinstrumentation-e2e-images.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: "Publish instrumentation E2E images" | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'tests/instrumentation-e2e-apps/**' | ||
- '.github/workflows/publish-autoinstrumentation-e2e-images.yaml' | ||
branches: | ||
- main | ||
pull_request: | ||
paths: | ||
- 'tests/instrumentation-e2e-apps/**' | ||
- '.github/workflows/publish-autoinstrumentation-e2e-images.yaml' | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
golang: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ghcr.io/open-telemetry/opentelemetry-operator/e2e-test-app-golang | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
|
||
- name: Login to GitHub Package Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: tests/instrumentation-e2e-apps/golang | ||
platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le | ||
push: ${{ github.event_name == 'push' }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM golang:1.21-alpine as builder | ||
|
||
COPY main.go . | ||
RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -o app main.go | ||
|
||
FROM scratch | ||
COPY --from=builder /go/app . | ||
ENTRYPOINT ["./app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
"time" | ||
) | ||
|
||
func main() { | ||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { | ||
fmt.Println("Hi") | ||
}) | ||
|
||
server := &http.Server{ | ||
Addr: ":8080", | ||
ReadHeaderTimeout: 3 * time.Second, | ||
} | ||
|
||
err := server.ListenAndServe() | ||
if err != nil { | ||
panic(err) | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make these constants for clarity?