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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 95 additions & 44 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,63 @@ workflows:
branches:
ignore:
- master
- postgres-compat:
matrix:
parameters:
postgres_version: ["14", "15", "16", "17"]
filters:
branches:
ignore:
- master

commands:
install-postgres-client-18:
description: Install the PostgreSQL v18 client tools from the official PGDG apt repo.
steps:
- run:
name: install Postgres client v18
command: |
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /usr/share/keyrings/pgdg.gpg
echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt-get update
sudo apt-get -y install postgresql-client-18

install-test-tooling:
description: Install jq, killall and a background minIO server used by the integration tests.
steps:
- run:
name: install killall
command: |
sudo apt-get update
sudo apt-get -y install psmisc
- run:
name: install jq
command: |
wget https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -qO jq
chmod +x jq
sudo mv jq /usr/local/bin/jq
- run:
name: run minIO server
command: |
wget https://dl.min.io/server/minio/release/linux-amd64/minio -qO minio
chmod +x minio
sudo mv minio /usr/local/bin/minio
minio server /tmp/data
background: true
environment:
MINIO_UPDATE: 'off'
MINIO_ACCESS_KEY: 6d611e2d-330b-4e52-a27c-59064d6e8a62
MINIO_SECRET_KEY: eW9sbywgeW91IGhhdmUganVzdCBiZWVuIHRyb2xsZWQh

install-backman-binary:
description: Build the backman binary and install it to /usr/local/bin so the integration scripts can find it.
steps:
- run: make build
- run:
name: install binary
command: |
sudo cp /home/circleci/project/backman /usr/local/bin/backman
sudo chmod +x /usr/local/bin/backman

jobs:
build:
Expand All @@ -17,7 +74,9 @@ jobs:
- image: cimg/go:1.24.13-node

# service images available at `host: localhost`
- image: circleci/postgres:12-alpine
# postgres server defaults to v18 here so the main build exercises the v18 client
# against the v18 server. Older server versions are covered by the postgres-compat job.
- image: postgres:18-alpine
environment:
POSTGRES_USER: dev-user
POSTGRES_PASSWORD: dev-secret
Expand All @@ -41,51 +100,14 @@ jobs:
# unit tests
- run: make test

# build binary
- run: make build
- run:
name: install binary
command: |
chmod +x /home/circleci/project/backman
sudo cp /home/circleci/project/backman /usr/local/bin/backman
sudo chmod +x /usr/local/bin/backman

# minIO server
- run:
name: run minIO server
command: |
wget https://dl.min.io/server/minio/release/linux-amd64/minio -qO minio
chmod +x minio
sudo mv minio /usr/local/bin/minio
minio server /tmp/data
background: true
environment:
MINIO_UPDATE: 'off'
MINIO_ACCESS_KEY: 6d611e2d-330b-4e52-a27c-59064d6e8a62
MINIO_SECRET_KEY: eW9sbywgeW91IGhhdmUganVzdCBiZWVuIHRyb2xsZWQh
# build & install binary
- install-backman-binary

# killall
- run:
name: install killall
command: |
sudo apt-get update
sudo apt-get -y install psmisc
# tooling
- install-test-tooling

# jq
- run:
name: install jq
command: |
wget https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -qO jq
chmod +x jq
sudo mv jq /usr/local/bin/jq

- run:
name: install Postgres client v17
command: |
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /usr/share/keyrings/pgdg.gpg
echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt-get update
sudo apt-get -y install postgresql-client-17
# postgres integration test against the default (v18) server
- install-postgres-client-18
- run: make postgres-test

- run:
Expand All @@ -108,3 +130,32 @@ jobs:
name: install MySQL client
command: sudo apt install -y mariadb-client
- run: make mysql-test

# postgres-compat verifies the v18 client can still back up older Postgres
# servers we support. One run per parameterized server version.
postgres-compat:
parameters:
postgres_version:
description: PostgreSQL server major version to run as the secondary container.
type: string
docker:
- image: cimg/go:1.24.13-node

- image: postgres:<< parameters.postgres_version >>-alpine
environment:
POSTGRES_USER: dev-user
POSTGRES_PASSWORD: dev-secret
POSTGRES_DB: my_postgres_db

steps:
- checkout
- install-backman-binary
- install-test-tooling
- install-postgres-client-18
- run:
name: report client/server versions under test
command: |
echo "postgres client: $(psql --version)"
echo "pg_dump: $(pg_dump --version)"
echo "postgres server: << parameters.postgres_version >>"
- run: make postgres-test
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \
tee /etc/apt/sources.list.d/mongodb-org-7.0.list
RUN curl -sL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get -y $package_args update && \
apt-get -y $package_args install mysql-client postgresql-client-17 mongodb-database-tools=100.13.0 mongodb-org-tools=7.0.24 mongodb-org-shell=7.0.24 redis-tools nodejs openssh-server bash vim-tiny && \
apt-get -y $package_args install mysql-client postgresql-client-18 mongodb-database-tools=100.13.0 mongodb-org-tools=7.0.24 mongodb-org-shell=7.0.24 redis-tools nodejs openssh-server bash vim-tiny && \
apt-get clean && \
find /usr/share/doc/*/* ! -name copyright | xargs rm -rf && \
rm -rf \
Expand Down
3 changes: 1 addition & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package config

import (
"encoding/json"
"io/ioutil"
"log"
"os"
"strconv"
Expand Down Expand Up @@ -94,7 +93,7 @@ func new() *Config {

// first, load the config file if it exists
if _, err := os.Stat(configFile); err == nil {
data, err := ioutil.ReadFile(configFile)
data, err := os.ReadFile(configFile)
if err != nil {
log.Printf("could not load '%s'\n", configFile)
log.Fatalln(err.Error())
Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/robfig/cron v1.2.0
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.11.1
golang.org/x/crypto v0.46.0
golang.org/x/crypto v0.48.0
)

require (
Expand All @@ -42,9 +42,9 @@ require (
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
golang.org/x/net v0.48.0 // indirect
golang.org/x/sys v0.39.0 // indirect
golang.org/x/text v0.32.0 // indirect
golang.org/x/net v0.49.0 // indirect
golang.org/x/sys v0.41.0 // indirect
golang.org/x/text v0.34.0 // indirect
golang.org/x/time v0.14.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -122,26 +122,26 @@ go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts=
golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA=
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
Expand Down
5 changes: 0 additions & 5 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"strconv"
"strings"
"time"

"github.com/swisscom/backman/config"
"github.com/swisscom/backman/log"
"github.com/swisscom/backman/service/elasticsearch"
Expand All @@ -20,10 +19,6 @@ import (
"github.com/swisscom/backman/state"
)

func init() {
rand.Seed(time.Now().UTC().UnixNano())
}

func Init() {
mergeServiceBindings() // find and merge SERVICE_BINDING_ROOT/<service> into config.Services
mergeVCAPServices() // find and merge VCAP_SERVICES into config.Services
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions vendor/golang.org/x/crypto/chacha20poly1305/fips140only_go1.26.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/golang.org/x/crypto/scrypt/scrypt.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions vendor/golang.org/x/net/http2/writesched_priority_rfc9218.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/golang.org/x/sys/cpu/cpu_arm64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/golang.org/x/sys/cpu/cpu_other_arm64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading