Skip to content
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

sec: Upgrade Ubuntu to latest LTS version #6992

Merged
merged 15 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check-linux-build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
check-linux-build-image:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
name: Build
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-latest"
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ internal API changes are not present.
Main (unreleased)
-----------------

### Other changes

- Change the Docker base image for Linux containers to `ubuntu:noble`. (@amontalban)

v0.42.0 (2024-07-24)
-------------------------

Expand Down
2 changes: 1 addition & 1 deletion cmd/grafana-agent-operator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
RELEASE_BUILD=${RELEASE_BUILD} VERSION=${VERSION} \
make operator

FROM public.ecr.aws/ubuntu/ubuntu:mantic
FROM public.ecr.aws/ubuntu/ubuntu:noble

LABEL org.opencontainers.image.source="https://github.com/grafana/agent"

Expand Down
2 changes: 1 addition & 1 deletion cmd/grafana-agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
GOEXPERIMENT=${GOEXPERIMENT} \
make agent

FROM public.ecr.aws/ubuntu/ubuntu:mantic
FROM public.ecr.aws/ubuntu/ubuntu:noble

#Username and uid for grafana-agent user
ARG UID=473
Expand Down
2 changes: 1 addition & 1 deletion cmd/grafana-agentctl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
GO_TAGS="netgo promtail_journal_enabled" \
make agentctl

FROM public.ecr.aws/ubuntu/ubuntu:mantic
FROM public.ecr.aws/ubuntu/ubuntu:noble

LABEL org.opencontainers.image.source="https://github.com/grafana/agent"

Expand Down
28 changes: 24 additions & 4 deletions internal/cmd/integration-tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,42 @@ type TestLog struct {

var logChan chan TestLog

func executeCommand(command string, args []string, taskDescription string) {
func executeCommand(command string, args []string, taskDescription string) bool {
fmt.Printf("%s...\n", taskDescription)
cmd := exec.Command(command, args...)
var stderr bytes.Buffer
cmd.Stderr = &stderr
var stdout bytes.Buffer
cmd.Stdout = &stdout

success := true
if err := cmd.Run(); err != nil {
log.Fatalf("Error: %s\n", stderr.String())
stderrStr := stderr.String()
if len(stderrStr) > 0 {
log.Fatalf("stderr: %s\n", stderrStr)
} else {
log.Fatalf("Task '%s' failed, but no stderr was printed\n", taskDescription)
}
ptodev marked this conversation as resolved.
Show resolved Hide resolved
success = false
}
stdoutStr := stderr.String()
if len(stdoutStr) > 0 {
log.Printf("stdout:%s\n", stdoutStr)
} else {
log.Printf("No stdout was printed from task '%s'\n", taskDescription)
}
return success
}

func buildAgent() {
executeCommand("make", []string{"-C", "../../..", "agent-flow"}, "Building agent")
}

func setupEnvironment() {
executeCommand("docker-compose", []string{"up", "-d"}, "Setting up environment with Docker Compose")
success := executeCommand("docker", []string{"compose", "up", "-d"}, "Setting up environment with Docker Compose")
if !success {
executeCommand("docker", []string{"ps", "-las"}, "Docker ps")
}
fmt.Println("Sleep for 30 seconds to ensure that the env has time to initialize...")
time.Sleep(30 * time.Second)
}
Expand Down Expand Up @@ -114,7 +134,7 @@ func runAllTests() {

func cleanUpEnvironment() {
fmt.Println("Cleaning up Docker environment...")
err := exec.Command("docker-compose", "down", "--volumes", "--rmi", "all").Run()
err := exec.Command("docker", "compose", "down", "--volumes", "--rmi", "all").Run()
if err != nil {
panic(err)
}
Expand Down