-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/personality
- Loading branch information
Showing
90 changed files
with
2,792 additions
and
1,493 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
linters: | ||
disable-all: true | ||
enable: | ||
- gci | ||
linters-settings: | ||
gci: | ||
sections: | ||
- standard | ||
- default | ||
- Prefix(github.com/canonical/pebble) | ||
issues: | ||
# these values ensure that all issues will be surfaced | ||
max-issues-per-linter: 0 | ||
max-same-issues: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# ignore known CVEs that are not backported before Go 1.17 | ||
|
||
CVE-2022-41721 | ||
CVE-2022-41717 | ||
CVE-2022-41723 | ||
CVE-2022-32149 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
timeout: 20m | ||
scan: | ||
offline-scan: true | ||
ignore-file: .github/.trivyignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Lint | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-mod-file: 'go.mod' | ||
cache: false | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
id: lint | ||
with: | ||
version: latest | ||
args: '-c .github/.golangci.yml --out-format=colored-line-number' | ||
skip-cache: true | ||
|
||
- name: Print error message | ||
if: always() && steps.lint.outcome == 'failure' | ||
run: | | ||
echo ' | ||
Linting failed. On your local machine, please run | ||
golangci-lint run -c .github/.golangci.yml --fix | ||
and check in the changes.' | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Vulnerability scanning | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
scan: | ||
name: Scan for known vulnerabilities | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Run Github Trivy FS Action | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
scan-type: 'fs' | ||
scan-ref: '.' | ||
trivy-config: .github/trivy.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
name: Pebble snap | ||
|
||
on: | ||
pull_request: | ||
branches: [master] | ||
release: | ||
types: [published] | ||
|
||
env: | ||
SNAP_NAME: pebble | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
pebble-snap: ${{ steps.build-pebble-snap.outputs.snap }} | ||
|
||
steps: | ||
- name: Checkout Pebble repo | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Build Pebble Snap | ||
id: build-pebble-snap | ||
uses: snapcore/action-build@v1 | ||
|
||
- name: Attach pebble snap to GH workflow execution | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ steps.build-pebble-snap.outputs.snap }} | ||
path: ${{ steps.build-pebble-snap.outputs.snap }} | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
outputs: | ||
pebble-version: ${{ steps.install-pebble.outputs.version }} | ||
|
||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ needs.build.outputs.pebble-snap }} | ||
|
||
- name: Install the Pebble snap | ||
id: install-pebble | ||
run: | | ||
set -ex | ||
# Install the Pebble snap from the artifact built in the previous job | ||
sudo snap install --dangerous --classic ${{ needs.build.outputs.pebble-snap }} | ||
# Make sure Pebble is installed | ||
echo "version=$(pebble version --client)" >> "$GITHUB_OUTPUT" | ||
- name: Run smoke test | ||
run: pebble enter --create-dirs exec echo Hello | grep Hello | ||
|
||
promote: | ||
if: ${{ github.event_name == 'release' }} | ||
runs-on: ubuntu-latest | ||
needs: [test] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: [amd64, arm64, ppc64el, armhf, s390x] | ||
env: | ||
TRACK: latest | ||
DEFAULT_RISK: edge | ||
TO_RISK: candidate | ||
steps: | ||
- name: Install Snapcraft | ||
run: sudo snap install snapcraft --classic | ||
|
||
- name: Wait for ${{ needs.test.outputs.pebble-version }} to be released | ||
env: | ||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} | ||
run: | | ||
while ! `snapcraft status ${{ env.SNAP_NAME }} --track ${{ env.TRACK }} --arch ${{ matrix.arch }} \ | ||
| grep "${{ env.DEFAULT_RISK }}" \ | ||
| awk -F' ' '{print $2}' \ | ||
| grep -Fxq "${{ needs.test.outputs.pebble-version }}"`; do | ||
echo "[${{ matrix.arch }}] Waiting for ${{ needs.test.outputs.pebble-version }} \ | ||
to be released to ${{ env.TRACK }}/${{ env.DEFAULT_RISK }}..." | ||
sleep 10 | ||
done | ||
# It would be easier to use `snapcraft promote`, but there's an error when trying | ||
# to avoid the prompt with the "--yes" option: | ||
# > 'latest/edge' is not a valid set value for --from-channel when using --yes. | ||
- name: Promote ${{ needs.test.outputs.pebble-version }} (${{ matrix.arch }}) to ${{ env.TO_RISK }} | ||
env: | ||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} | ||
run: | | ||
revision="$(snapcraft status ${{ env.SNAP_NAME }} \ | ||
--track ${{ env.TRACK }} --arch ${{ matrix.arch }} \ | ||
| grep "${{ env.DEFAULT_RISK }}" | awk -F' ' '{print $3}')" | ||
snapcraft release ${{ env.SNAP_NAME }} \ | ||
$revision \ | ||
${{ env.TRACK }}/${{ env.TO_RISK }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.