Skip to content

Commit

Permalink
Bumping actions versions. Replacing deprecated ioutil functions
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelattwood committed Jun 27, 2023
1 parent e1ebf2c commit 07b6cb2
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 34 deletions.
23 changes: 9 additions & 14 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: '1.19'
go-version: '1.20'

- name: Setup QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -35,20 +35,15 @@ jobs:
echo tags="latest,${version}" >> $GITHUB_OUTPUT
- name: Build and Push
# 2023-05-07 note: the action documents:
# This repository is considered EXPERIMENTAL and under active development
# until further notice. It is subject to non-backward compatible changes
# or removal in any future version
# thus while v3.0.1 is the latest, I'm leaving this on v2 for an owner to
# investigate.
uses: docker/bake-action@v2
env:
TAGS: "${{ steps.tags.outputs.tags }}"
REGISTRY: "natsio"
uses: docker/bake-action@v3
with:
files: docker-bake.hcl
push: true
set:
set: |
goreleaser.args.GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
env:
TAGS: "${{ steps.tags.outputs.tags }}"
REGISTRY: "natsio"

- name: Attach Release Files
run: gh release upload ${{ github.ref_name }} deploy/crds.yml deploy/rbac.yml
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/testing.yaml → .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
name: Testing
name: Test

on:
- push
- pull_request
on: [push, pull_request]

jobs:
build:
name: Testing Job
runs-on: ubuntu-20.04
name: Test
runs-on: ubuntu-latest
steps:
- name: Setup Go
id: setup-go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: '^1.19'
go-version: '1.20'

- name: Checkout source
uses: actions/checkout@v3

- name: Build
run: make build

- name: Test
run: make test
11 changes: 5 additions & 6 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ builds:
main: ./cmd/jetstream-controller
binary: jetstream-controller
ldflags:
- -s -w -X main.BuildTime={{.Date}} -X main.GitInfo={{.Commit}} -X main.Version={{.Version}}
- -s -w -X main.Version={{.Version}} -X main.GitInfo={{.ShortCommit}} -X main.BuildTime={{.Date}}
tags:
- timetzdata
env:
- GO11MODULE=on
- CGO_ENABLED=0
goos:
- linux
Expand All @@ -29,15 +28,15 @@ builds:
goarm:
- 6
- 7

- id: nats-boot-config
main: ./cmd/nats-boot-config
binary: nats-boot-config
ldflags:
- -s -w -X main.BuildTime={{.Date}} -X main.GitInfo={{.Commit}} -X main.Version={{.Version}}
- -s -w -X main.Version={{.Version}} -X main.GitInfo={{.ShortCommit}} -X main.BuildTime={{.Date}}
tags:
- timetzdata
env:
- GO11MODULE=on
- CGO_ENABLED=0
goos:
- linux
Expand All @@ -48,15 +47,15 @@ builds:
goarm:
- 6
- 7

- id: nats-server-config-reloader
main: ./cmd/nats-server-config-reloader
binary: nats-server-config-reloader
ldflags:
- -s -w -X main.BuildTime={{.Date}} -X main.GitInfo={{.Commit}} -X main.Version={{.Version}}
- -s -w -X main.Version={{.Version}} -X main.GitInfo={{.ShortCommit}} -X main.BuildTime={{.Date}}
tags:
- timetzdata
env:
- GO11MODULE=on
- CGO_ENABLED=0
goos:
- linux
Expand Down
5 changes: 2 additions & 3 deletions pkg/bootconfig/bootconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"context"
"errors"
"fmt"
"io/ioutil"
"os"

log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -122,15 +121,15 @@ func (c *Controller) Run(ctx context.Context) error {

clientAdvertiseConfig := fmt.Sprintf("\nclient_advertise = \"%s\"\n\n", externalAddress)

err = ioutil.WriteFile(c.opts.ClientAdvertiseFileName, []byte(clientAdvertiseConfig), 0644)
err = os.WriteFile(c.opts.ClientAdvertiseFileName, []byte(clientAdvertiseConfig), 0644)
if err != nil {
return fmt.Errorf("Could not write client advertise config: %s", err)
}
log.Infof("Successfully wrote client advertise config to %q", c.opts.ClientAdvertiseFileName)

gatewayAdvertiseConfig := fmt.Sprintf("\nadvertise = \"%s\"\n\n", externalAddress)

err = ioutil.WriteFile(c.opts.GatewayAdvertiseFileName, []byte(gatewayAdvertiseConfig), 0644)
err = os.WriteFile(c.opts.GatewayAdvertiseFileName, []byte(gatewayAdvertiseConfig), 0644)
if err != nil {
return fmt.Errorf("Could not write gateway advertise config: %s", err)
}
Expand Down
5 changes: 2 additions & 3 deletions pkg/natsreloader/natsreloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"crypto/sha256"
"fmt"
"io"
"io/ioutil"
"log"
"math/rand"
"os"
Expand Down Expand Up @@ -49,7 +48,7 @@ func (r *Reloader) waitForProcess() error {

startTime := time.Now()
for {
pidfile, err := ioutil.ReadFile(r.PidFile)
pidfile, err := os.ReadFile(r.PidFile)
if err != nil {
goto WaitAndRetry
}
Expand All @@ -76,7 +75,7 @@ func (r *Reloader) waitForProcess() error {

if attempts > 0 {
log.Printf("found pid from pidfile %q after %v failed attempts (%v time after start)",
r.PidFile, attempts, time.Now().Sub(startTime))
r.PidFile, attempts, time.Since(startTime))
}

r.pid = pid
Expand Down

0 comments on commit 07b6cb2

Please sign in to comment.