Skip to content

Commit a511c6b

Browse files
Merge remote-tracking branch 'upstream/master' into svc-args
.. include the new changes in usptream into this PR.
2 parents 2d8ac71 + 13553aa commit a511c6b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1435
-146
lines changed

.github/workflows/binaries.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Binaries
2+
3+
on:
4+
push:
5+
tags: [v*]
6+
branches: [master]
7+
pull_request:
8+
branches: [master]
9+
release:
10+
types: [published]
11+
12+
jobs:
13+
create-binaries:
14+
strategy:
15+
matrix:
16+
goos: [linux]
17+
goarch: [amd64, arm64, ppc64le, riscv64, s390x]
18+
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Set up Go
28+
uses: actions/setup-go@v4
29+
with:
30+
go-version: stable # latest stable version of Go
31+
32+
- name: Build binary and create archive
33+
id: build
34+
env:
35+
GOOS: ${{ matrix.goos }}
36+
GOARCH: ${{ matrix.goarch }}
37+
CGO_ENABLED: "0"
38+
run: |
39+
echo Generating version file
40+
go generate ./cmd
41+
42+
echo Building for $GOOS $GOARCH
43+
go build -trimpath -ldflags='-s -w' -o dist/build/pebble ./cmd/pebble
44+
45+
# Get version via "pebble version" to ensure it matches that exactly
46+
PEBBLE_VERSION=$(GOOS=linux GOARCH=amd64 go run ./cmd/pebble version | awk '/client/ { print $2 }')
47+
48+
ARCHIVE_FILE=pebble_${PEBBLE_VERSION}_${GOOS}_${GOARCH}.tar.gz
49+
echo Creating archive $ARCHIVE_FILE
50+
cp COPYING dist/build
51+
cp README.md dist/build
52+
tar -czf dist/$ARCHIVE_FILE -C dist/build .
53+
54+
# Share variables with subsequent steps
55+
echo "ARCHIVE_FILE=${ARCHIVE_FILE}" >>$GITHUB_OUTPUT
56+
echo "PEBBLE_VERSION=${PEBBLE_VERSION}" >>$GITHUB_OUTPUT
57+
58+
- name: Upload archive as Actions artifact
59+
uses: actions/upload-artifact@v3
60+
with:
61+
name: ${{ steps.build.outputs.ARCHIVE_FILE }}
62+
path: dist/${{ steps.build.outputs.ARCHIVE_FILE }}
63+
64+
- name: Upload archive to release
65+
env:
66+
ARCHIVE_FILE: ${{ steps.build.outputs.ARCHIVE_FILE }}
67+
PEBBLE_VERSION: ${{ steps.build.outputs.PEBBLE_VERSION }}
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
if: ${{ github.event_name == 'release' }}
70+
run: |
71+
echo Uploading $ARCHIVE_FILE to release $PEBBLE_VERSION
72+
gh release upload $PEBBLE_VERSION dist/$ARCHIVE_FILE

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
name: Go ${{ matrix.go }}
1919

2020
steps:
21-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v3
2222

2323
- name: Set up Go
2424
uses: actions/setup-go@v3
@@ -36,7 +36,7 @@ jobs:
3636
name: Root Tests
3737

3838
steps:
39-
- uses: actions/checkout@v2
39+
- uses: actions/checkout@v3
4040

4141
- name: Set up Go
4242
uses: actions/setup-go@v3
@@ -59,7 +59,7 @@ jobs:
5959
name: Format check
6060

6161
steps:
62-
- uses: actions/checkout@v2
62+
- uses: actions/checkout@v3
6363

6464
- name: Set up Go
6565
uses: actions/setup-go@v3

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ cmd/VERSION
77
.idea
88
.vscode
99
/pebble
10+
11+
dist/

HACKING.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Hacking on Pebble
22

3+
- [Running the daemon](#running-the-daemon)
4+
- [Using the CLI client](#using-the-cli-client)
5+
- [Using Curl to hit the API](#using-curl-to-hit-the-api)
6+
- [Running the tests](#running-the-tests)
7+
- [Creating a release](#creating-a-release)
8+
39
Hacking on Pebble is easy. It's written in Go, so install or [download](https://golang.org/dl/) a copy of the latest version of Go. Pebble uses [Go modules](https://golang.org/ref/mod) for managing dependencies, so all of the standard Go tooling just works.
410

511
To compile and run Pebble, use the `go run` command on the `cmd/pebble` directory. The first time you run it, it will download dependencies and build packages, so will take a few seconds (but after that be very fast):
@@ -127,4 +133,16 @@ ok github.com/canonical/pebble/client (cached)
127133
? github.com/canonical/pebble/cmd [no test files]
128134
ok github.com/canonical/pebble/cmd/pebble 0.165s
129135
...
130-
```
136+
```
137+
138+
139+
## Creating a release
140+
141+
To create a new tagged release, go to the [GitHub Releases page](https://github.com/canonical/pebble/releases) and:
142+
143+
- Click "Create a new release"
144+
- Enter the version tag (eg: `v1.2.3`) and select "Create new tag: on publish"
145+
- Enter a release title: include the version tag and a short summary of the release
146+
- Write release notes: describe new features and bug fixes, and include a link to the full list of commits
147+
148+
Binaries will be created and uploaded automatically to this release by the [release.yml](https://github.com/canonical/pebble/blob/master/.github/workflows/release.yml) GitHub Actions job.

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,10 @@ services:
532532
# half a minute ("30s").
533533
backoff-limit: <duration>
534534
535+
# (Optional) The amount of time afforded to this service to handle
536+
# SIGTERM and exit gracefully before SIGKILL terminates it forcefully.
537+
# Default is 5 seconds ("5s").
538+
kill-delay: <duration>
535539
536540
# (Optional) A list of health checks managed by this configuration layer.
537541
checks:
@@ -559,7 +563,7 @@ checks:
559563
period: <duration>
560564
561565
# (Optional) If this time elapses before a single check operation has
562-
# finished, it is cancelled and considered an error. Must not be less
566+
# finished, it is cancelled and considered an error. Must be less
563567
# than the period, and must not be zero. Default is "3s".
564568
timeout: <duration>
565569

cmd/mkversion.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ set -e
1919
# that dh-golang creates and that only contains a subset of the
2020
# files of the toplevel buildir.
2121
PKG_BUILDDIR=$(dirname "$0")/..
22-
GO_GENERATE_BUILDDIR="$(pwd)"
22+
GO_GENERATE_BUILDDIR="$(pwd)/cmd"
2323

2424
# run from "go generate" adjust path
2525
if [ "$GOPACKAGE" = "cmd" ]; then
26-
GO_GENERATE_BUILDDIR="$(pwd)/.."
26+
GO_GENERATE_BUILDDIR="$(pwd)"
2727
fi
2828

2929
OUTPUT_ONLY=false
@@ -43,7 +43,7 @@ if [ -z "$v" ]; then
4343
if command -v git >/dev/null; then
4444
# not using "--dirty" here until the following bug is fixed:
4545
# https://bugs.launchpad.net/snapcraft/+bug/1662388
46-
v="$(git describe --always | sed -e 's/-/+git/;y/-/./' )"
46+
v="$(git describe --tags --always | sed -e 's/-/+git/;y/-/./' )"
4747
o=git
4848
fi
4949
fi

cmd/pebble/cmd_add.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"fmt"
1919
"io/ioutil"
2020

21-
"github.com/jessevdk/go-flags"
21+
"github.com/canonical/go-flags"
2222

2323
"github.com/canonical/pebble/client"
2424
)

cmd/pebble/cmd_autostart.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
package main
1616

1717
import (
18-
"github.com/jessevdk/go-flags"
18+
"github.com/canonical/go-flags"
1919

2020
"github.com/canonical/pebble/client"
2121
)

cmd/pebble/cmd_changes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"regexp"
2020
"sort"
2121

22-
"github.com/jessevdk/go-flags"
22+
"github.com/canonical/go-flags"
2323

2424
"github.com/canonical/pebble/client"
2525
)

cmd/pebble/cmd_checks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package main
1717
import (
1818
"fmt"
1919

20-
"github.com/jessevdk/go-flags"
20+
"github.com/canonical/go-flags"
2121

2222
"github.com/canonical/pebble/client"
2323
)

0 commit comments

Comments
 (0)