Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 7 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
# CI workflow for Flynn
#
# Builds all components and runs unit tests on every push and pull request
# to the tuf-rebuild branch. Uses a Debian container with Go 1.13.15 and
# to the tuf-rebuild branch. Uses a Debian container with Go 1.22.12 and
# all required system dependencies.
#
# The build uses script/bootstrap-build which compiles all 34 Flynn binaries
# from source without requiring a running Flynn cluster.
#
# Note: Debian Buster (10) is EOL and its repos are offline. We use
# Bookworm (12) for system packages; Go 1.13 is installed separately.

name: CI

on:
push:
branches: [tuf-rebuild, master]
branches: [tuf-rebuild, master, go-1.22-upgrade]
pull_request:
branches: [tuf-rebuild, master]
workflow_dispatch:

jobs:
build:
Expand All @@ -37,9 +35,9 @@ jobs:
curl \
ca-certificates

- name: Install Go 1.13.15
- name: Install Go 1.22.12
run: |
curl -fsSL "https://go.dev/dl/go1.13.15.linux-amd64.tar.gz" \
curl -fsSL "https://go.dev/dl/go1.22.12.linux-amd64.tar.gz" \
| tar -C /usr/local -xz
echo "/usr/local/go/bin" >> $GITHUB_PATH
echo "GOROOT=/usr/local/go" >> $GITHUB_ENV
Expand Down Expand Up @@ -80,9 +78,9 @@ jobs:
curl \
ca-certificates

- name: Install Go 1.13.15
- name: Install Go 1.22.12
run: |
curl -fsSL "https://go.dev/dl/go1.13.15.linux-amd64.tar.gz" \
curl -fsSL "https://go.dev/dl/go1.22.12.linux-amd64.tar.gz" \
| tar -C /usr/local -xz
echo "/usr/local/go/bin" >> $GITHUB_PATH
echo "GOROOT=/usr/local/go" >> $GITHUB_ENV
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Dockerfile.ci — Reproducible build environment for Flynn CI
#
# This image provides Go 1.13.15 with CGO support and all system dependencies
# This image provides Go 1.22.12 with CGO support and all system dependencies
# needed to build all Flynn components and run unit tests.
#
# Usage:
Expand All @@ -10,7 +10,7 @@
# For unit tests:
# docker run --rm -v $(pwd):/go/src/github.com/flynn/flynn -w /go/src/github.com/flynn/flynn flynn-ci make test-unit-standalone

FROM debian:buster-slim
FROM debian:bookworm-slim

# Avoid interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
Expand All @@ -37,8 +37,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Install Go 1.13.15 (the required version for this project)
ENV GO_VERSION=1.13.15
# Install Go 1.22.12 (latest patch release of Go 1.22)
ENV GO_VERSION=1.22.12
RUN curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
| tar -C /usr/local -xz

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ TEST_PACKAGES_STANDALONE = \
# ./pkg/term/... — requires /dev/tty (not available in CI containers)

test-unit-standalone:
GO111MODULE=on go test -mod=vendor -race -cover $(TEST_PACKAGES_STANDALONE)
go test -mod=vendor -race -cover $(TEST_PACKAGES_STANDALONE)

test-integration: build
script/run-integration-tests
Expand Down
2 changes: 1 addition & 1 deletion appliance/mariadb/cmd/flynn-mariadb-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/flynn/flynn/pkg/sirenia/scale"
_ "github.com/go-sql-driver/mysql"
"github.com/julienschmidt/httprouter"
"golang.org/x/net/context"
"context"
"github.com/inconshreveable/log15"
)

Expand Down
5 changes: 2 additions & 3 deletions appliance/mariadb/cmd/flynn-mariadb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"encoding/binary"
"io/ioutil"
"net"
"net/http"
"os"
Expand Down Expand Up @@ -38,14 +37,14 @@ func main() {

const dataDir = "/data"
idFile := filepath.Join(dataDir, "instance_id")
idBytes, err := ioutil.ReadFile(idFile)
idBytes, err := os.ReadFile(idFile)
if err != nil && !os.IsNotExist(err) {
shutdown.Fatalf("error reading instance ID: %s", err)
}
id := string(idBytes)
if len(id) == 0 {
id = random.UUID()
if err := ioutil.WriteFile(idFile, []byte(id), 0644); err != nil {
if err := os.WriteFile(idFile, []byte(id), 0644); err != nil {
shutdown.Fatalf("error writing instance ID: %s", err)
}
}
Expand Down
7 changes: 3 additions & 4 deletions appliance/mariadb/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"os"
Expand Down Expand Up @@ -326,7 +325,7 @@ type BackupInfo struct {
}

func (p *Process) extractBackupInfo() (*BackupInfo, error) {
buf, err := ioutil.ReadFile(filepath.Join(p.DataDir, "xtrabackup_binlog_info"))
buf, err := os.ReadFile(filepath.Join(p.DataDir, "xtrabackup_binlog_info"))
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -357,7 +356,7 @@ func (p *Process) Restore(r io.Reader) (*BackupInfo, error) {

func (p *Process) unpackXbstream(r io.Reader) error {
cmd := exec.Command(filepath.Join(p.BinDir, "xbstream"), "-x", "--directory="+p.DataDir)
cmd.Stdin = ioutil.NopCloser(r)
cmd.Stdin = io.NopCloser(r)

if buf, err := cmd.CombinedOutput(); err != nil {
p.Logger.Error("xbstream failed", "err", err, "output", string(buf))
Expand Down Expand Up @@ -437,7 +436,7 @@ func (p *Process) assumeStandby(upstream, downstream *discoverd.Instance) error

return nil
}(); err != nil {
if files, err := ioutil.ReadDir("/data"); err == nil {
if files, err := os.ReadDir("/data"); err == nil {
for _, file := range files {
os.RemoveAll(filepath.Join("/data", file.Name()))
}
Expand Down
7 changes: 3 additions & 4 deletions appliance/mongodb/cmd/flynn-mongodb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"encoding/binary"
"io/ioutil"
"net"
"net/http"
"os"
Expand Down Expand Up @@ -38,20 +37,20 @@ func main() {

const dataDir = "/data"
idFile := filepath.Join(dataDir, "instance_id")
idBytes, err := ioutil.ReadFile(idFile)
idBytes, err := os.ReadFile(idFile)
if err != nil && !os.IsNotExist(err) {
shutdown.Fatalf("error reading instance ID: %s", err)
}
id := string(idBytes)
if len(id) == 0 {
id = random.UUID()
if err := ioutil.WriteFile(idFile, []byte(id), 0644); err != nil {
if err := os.WriteFile(idFile, []byte(id), 0644); err != nil {
shutdown.Fatalf("error writing instance ID: %s", err)
}
}

keyFile := filepath.Join(dataDir, "Keyfile")
if err := ioutil.WriteFile(keyFile, []byte(password), 0600); err != nil {
if err := os.WriteFile(keyFile, []byte(password), 0600); err != nil {
shutdown.Fatalf("error writing keyfile: %s", err)
}

Expand Down
8 changes: 4 additions & 4 deletions appliance/mongodb/process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package mongodb
import (
"errors"
"fmt"
"io/ioutil"
"os"
"net"
"net/http"
"path/filepath"
Expand Down Expand Up @@ -36,7 +36,7 @@ func (MongoDBSuite) TestSingletonPrimary(c *C) {
p.Port = "8500"
p.OpTimeout = 30 * time.Second
keyFile := filepath.Join(p.DataDir, "Keyfile")
err := ioutil.WriteFile(keyFile, []byte("password"), 0600)
err := os.WriteFile(keyFile, []byte("password"), 0600)
c.Assert(err, IsNil)
topology := &state.State{Singleton: true, Primary: instance(p)}
err = p.Reconfigure(&state.Config{Role: state.RolePrimary, State: topology})
Expand All @@ -62,7 +62,7 @@ func (MongoDBSuite) TestSingletonPrimary(c *C) {
p.Port = "8500"
p.OpTimeout = 30 * time.Second
keyFile = filepath.Join(p.DataDir, "Keyfile")
err = ioutil.WriteFile(keyFile, []byte("password"), 0600)
err = os.WriteFile(keyFile, []byte("password"), 0600)
c.Assert(err, IsNil)
err = p.Reconfigure(&state.Config{Role: state.RolePrimary, State: topology})
c.Assert(err, IsNil)
Expand Down Expand Up @@ -487,7 +487,7 @@ func NewTestProcess(c *C, n uint32) *Process {
p.OpTimeout = 30 * time.Second
p.Logger = p.Logger.New("id", p.ID, "port", p.Port)
keyFile := filepath.Join(p.DataDir, "Keyfile")
err := ioutil.WriteFile(keyFile, []byte("password"), 0600)
err := os.WriteFile(keyFile, []byte("password"), 0600)
c.Assert(err, IsNil)
return p
}
Expand Down
2 changes: 1 addition & 1 deletion appliance/postgresql/cmd/flynn-postgres-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/flynn/flynn/pkg/resource"
"github.com/flynn/flynn/pkg/shutdown"
"github.com/julienschmidt/httprouter"
"golang.org/x/net/context"
"context"
)

const (
Expand Down
5 changes: 2 additions & 3 deletions appliance/postgresql/cmd/flynn-postgres/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"io/ioutil"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -30,14 +29,14 @@ func main() {

const dataDir = "/data"
idFile := filepath.Join(dataDir, "instance_id")
idBytes, err := ioutil.ReadFile(idFile)
idBytes, err := os.ReadFile(idFile)
if err != nil && !os.IsNotExist(err) {
shutdown.Fatalf("error reading instance ID: %s", err)
}
id := string(idBytes)
if len(id) == 0 {
id = random.UUID()
if err := ioutil.WriteFile(idFile, []byte(id), 0644); err != nil {
if err := os.WriteFile(idFile, []byte(id), 0644); err != nil {
shutdown.Fatalf("error writing instance ID: %s", err)
}
}
Expand Down
1 change: 1 addition & 0 deletions appliance/postgresql/cmd/simcli/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Don't build to avoid vendoring uniline
//go:build ignore
// +build ignore

package main
Expand Down
7 changes: 3 additions & 4 deletions appliance/postgresql/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package postgresql
import (
"errors"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -348,7 +347,7 @@ func (p *Process) assumePrimary(downstream *discoverd.Instance) (err error) {
if p.running() && p.config().Role == state.RoleSync {
log.Info("promoting to primary")

if err := ioutil.WriteFile(p.triggerPath(), nil, 0655); err != nil {
if err := os.WriteFile(p.triggerPath(), nil, 0655); err != nil {
log.Error("error creating trigger file", "path", p.triggerPath(), "err", err)
return err
}
Expand Down Expand Up @@ -469,7 +468,7 @@ func (p *Process) assumeStandby(upstream, downstream *discoverd.Instance) error
))
if err != nil {
log.Error("error pulling basebackup", "err", err)
if files, err := ioutil.ReadDir("/data"); err == nil {
if files, err := os.ReadDir("/data"); err == nil {
for _, file := range files {
os.RemoveAll(filepath.Join("/data", file.Name()))
}
Expand Down Expand Up @@ -861,7 +860,7 @@ func (p *Process) writeRecoveryConf(upstream *discoverd.Instance) error {
}

func (p *Process) writeHBAConf() error {
return ioutil.WriteFile(p.hbaConfPath(), hbaConf, 0644)
return os.WriteFile(p.hbaConfPath(), hbaConf, 0644)
}

func (p *Process) configPath() string {
Expand Down
5 changes: 2 additions & 3 deletions appliance/redis/cmd/flynn-redis/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"os"
Expand Down Expand Up @@ -193,7 +192,7 @@ func (m *Main) Close() error {
// readID reads the instance id from path.
// If the file instance id doesn't exist then a random ID is generated.
func (m *Main) readID(path string) (string, error) {
buf, err := ioutil.ReadFile(path)
buf, err := os.ReadFile(path)
if err != nil && !os.IsNotExist(err) {
return "", fmt.Errorf("error reading instance ID: %s", err)
}
Expand All @@ -206,7 +205,7 @@ func (m *Main) readID(path string) (string, error) {

// Generate a new ID and write it to file.
id = random.UUID()
if err := ioutil.WriteFile(path, []byte(id), 0644); err != nil {
if err := os.WriteFile(path, []byte(id), 0644); err != nil {
return "", fmt.Errorf("error writing instance ID: %s", err)
}
return id, nil
Expand Down
3 changes: 1 addition & 2 deletions appliance/redis/cmd/flynn-redis/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main_test
import (
"bytes"
"io"
"io/ioutil"
"os"
"reflect"
"testing"
Expand Down Expand Up @@ -70,7 +69,7 @@ type Main struct {
// NewMain returns a new instance of Main.
func NewMain() *Main {
// Create a temporary data directory.
dataDir, err := ioutil.TempDir("", "flynn-redis-")
dataDir, err := os.MkdirTemp("", "flynn-redis-")
if err != nil {
panic(err)
}
Expand Down
4 changes: 2 additions & 2 deletions appliance/redis/process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package redis_test

import (
"fmt"
"io/ioutil"
"os"
"net"
"os"
"os/exec"
Expand Down Expand Up @@ -110,7 +110,7 @@ type Process struct {
// NewProcess creates a new Process on a random port.
func NewProcess() *Process {
// Create temporary directory for data.
path, err := ioutil.TempDir("", "flynn-redis-")
path, err := os.MkdirTemp("", "flynn-redis-")
if err != nil {
panic(err)
}
Expand Down
Loading
Loading