mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 00:45:19 +00:00
Implement release automation (#1215)
- Use goreleaser to automate release process. - Add new dockerfiles for fleet (with fleetctl) and fleetctl (only). - Add GitHub Action Workflow to run goreleaser on new tag. - Update NPM to match new archive naming.
This commit is contained in:
parent
7aa380b0f0
commit
07b89c4cbd
44
.github/workflows/goreleaser.yaml
vendored
Normal file
44
.github/workflows/goreleaser.yaml
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
name: goreleaser
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0 # Needed for goreleaser
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 # v1.10.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.16.5
|
||||
|
||||
- name: Install JS Dependencies
|
||||
run: make deps-js
|
||||
|
||||
- name: Install Go Dependencies
|
||||
run: make deps-go
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@ac067437f516133269923265894e77920c3dce18 # v2.6.1
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --rm-dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
120
.goreleaser.yml
Normal file
120
.goreleaser.yml
Normal file
@ -0,0 +1,120 @@
|
||||
project_name: fleet
|
||||
|
||||
before:
|
||||
hooks:
|
||||
- make deps
|
||||
- make generate
|
||||
|
||||
gomod:
|
||||
proxy: true
|
||||
|
||||
builds:
|
||||
- id: fleet
|
||||
dir: ./cmd/fleet/
|
||||
binary: fleet
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- darwin
|
||||
- linux
|
||||
- windows
|
||||
goarch:
|
||||
- amd64
|
||||
flags:
|
||||
- -tags=full
|
||||
- -trimpath
|
||||
ldflags:
|
||||
- -X github.com/kolide/kit/version.appName={{ .ArtifactName }}
|
||||
- -X github.com/kolide/kit/version.version={{ .Version }}
|
||||
- -X github.com/kolide/kit/version.branch={{ .Branch }}
|
||||
- -X github.com/kolide/kit/version.revision={{ .FullCommit }}
|
||||
- -X github.com/kolide/kit/version.buildDate={{ time "2006-01-02" }}
|
||||
- -X github.com/kolide/kit/version.buildUser={{ .Env.USER }}
|
||||
|
||||
- id: fleetctl
|
||||
dir: ./cmd/fleetctl/
|
||||
binary: fleetctl
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- darwin
|
||||
- linux
|
||||
- windows
|
||||
goarch:
|
||||
- amd64
|
||||
flags:
|
||||
- -trimpath
|
||||
ldflags:
|
||||
- -X github.com/kolide/kit/version.appName={{ .ArtifactName }}
|
||||
- -X github.com/kolide/kit/version.version={{ .Version }}
|
||||
- -X github.com/kolide/kit/version.branch={{ .Branch }}
|
||||
- -X github.com/kolide/kit/version.revision={{ .FullCommit }}
|
||||
- -X github.com/kolide/kit/version.buildDate={{ time "2006-01-02" }}
|
||||
- -X github.com/kolide/kit/version.buildUser={{ .Env.USER }}
|
||||
|
||||
archives:
|
||||
- id: fleet
|
||||
builds:
|
||||
- fleet
|
||||
- fleetctl
|
||||
name_template: fleet_{{.Version}}_{{.Os}}
|
||||
replacements:
|
||||
darwin: macos
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
|
||||
- id: fleetctl
|
||||
builds:
|
||||
- fleetctl
|
||||
name_template: fleetctl_{{.Version}}_{{.Os}}
|
||||
replacements:
|
||||
darwin: macos
|
||||
|
||||
- id: fleetctl-zip
|
||||
builds:
|
||||
- fleetctl
|
||||
name_template: fleetctl_{{.Version}}_{{.Os}}
|
||||
format: zip
|
||||
replacements:
|
||||
darwin: macos
|
||||
|
||||
dockers:
|
||||
- goos: linux
|
||||
goarch: amd64
|
||||
ids:
|
||||
- fleet
|
||||
- fleetctl
|
||||
dockerfile: tools/docker/fleet.Dockerfile
|
||||
image_templates:
|
||||
- 'fleetdm/fleet:latest'
|
||||
- 'fleetdm/fleet:{{ .Tag }}'
|
||||
- 'fleetdm/fleet:{{ .Tag }}'
|
||||
- 'fleetdm/fleet:v{{ .Major }}'
|
||||
|
||||
- goos: linux
|
||||
goarch: amd64
|
||||
ids:
|
||||
- fleetctl
|
||||
dockerfile: tools/docker/fleetctl.Dockerfile
|
||||
image_templates:
|
||||
- 'fleetdm/fleetctl:latest'
|
||||
- 'fleetdm/fleetctl:{{ .Tag }}'
|
||||
- 'fleetdm/fleetctl:{{ .Tag }}'
|
||||
- 'fleetdm/fleetctl:v{{ .Major }}'
|
||||
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}-untagged"
|
||||
|
||||
changelog:
|
||||
skip: true
|
||||
|
||||
release:
|
||||
github:
|
||||
owner: fleetdm
|
||||
name: fleet
|
||||
draft: true
|
||||
prerelease: auto
|
@ -15,15 +15,17 @@ git push origin v<VERSION>
|
||||
|
||||
Note that `origin` may be `upstream` depending on your `git remote` configuration. The intent here is to push the new tag to the `github.com/fleetdm/fleet` repository.
|
||||
|
||||
3. Build the new binary bundle (ensure working tree is clean because this will effect the version string built into the binary):
|
||||
GitHub Actions will automatically begin building the new release after the tag is pushed.
|
||||
|
||||
```shell
|
||||
make binary-bundle
|
||||
```
|
||||
---
|
||||
|
||||
Make note of the SHA256 checksum output at the end of this build command to paste into the release documentation on GitHub.
|
||||
Wait while GitHub Actions creates and uploads the artifacts...
|
||||
|
||||
4. Create a new release on the [GitHub releases page](https://github.com/fleetdm/fleet/releases). Select the newly pushed tag (GitHub should say "Existing tag"). Use the version number as the release title. Use the below template for the release description (replace items in <> with the appropriate values):
|
||||
---
|
||||
|
||||
When the Actions Workflow has completed:
|
||||
|
||||
3. Edit the draft release on the [GitHub releases page](https://github.com/fleetdm/fleet/releases). Use the version number as the release title. Use the below template for the release description (replace items in <> with the appropriate values):
|
||||
|
||||
````
|
||||
### Changes
|
||||
@ -42,27 +44,14 @@ Documentation for this release can be found at https://github.com/fleetdm/fleet/
|
||||
|
||||
**SHA256**
|
||||
```
|
||||
<HASH VALUE> fleet.zip
|
||||
<HASH VALUE> fleetctl.exe.zip
|
||||
<HASH VALUE> fleetctl-linux.tar.gz
|
||||
<HASH VALUE> fleetctl-macos.tar.gz
|
||||
<HASH VALUE> fleetctl-windows.tar.gz
|
||||
<COPY FROM checksums.txt>
|
||||
```
|
||||
|
||||
````
|
||||
|
||||
Upload `fleet.zip`, `fleetctl-*.tar.gz`, and `fleetctl.exe.zip`. Click "Publish Release".
|
||||
When editing is complete, publish the release.
|
||||
|
||||
5. Push the new version to Docker Hub (ensure working tree is clean because this will effect the version string built into the binary):
|
||||
4. Publish the new version of `fleetctl` on NPM. Run `npm publish` in the [fleetctl-npm](../../tools/fleetctl-npm/) directory. Note that NPM does not allow replacing a package without creating a new version number. Take care to get things correct before running `npm publish`!
|
||||
|
||||
```shell
|
||||
make docker-push-release
|
||||
```
|
||||
|
||||
6. Publish the new version of `fleetctl` on NPM. Run `npm publish` in the [fleetctl-npm](../../tools/fleetctl-npm/) directory. Note that NPM does not allow replacing a package without creating a new version number. Take care to get things correct before running `npm publish`!
|
||||
|
||||
7. Announce the release in the #fleet channel of [osquery Slack](https://osquery.slack.com/join/shared_invite/zt-h29zm0gk-s2DBtGUTW4CFel0f0IjTEw#/) and update the channel's topic with the link to this release. Using `@here` requires admin permissions, so typically this announcement will be done by `@zwass`.
|
||||
5. Announce the release in the #fleet channel of [osquery Slack](https://osquery.slack.com/join/shared_invite/zt-h29zm0gk-s2DBtGUTW4CFel0f0IjTEw#/) and update the channel's topic with the link to this release. Using `@here` requires admin permissions, so typically this announcement will be done by `@zwass`.
|
||||
|
||||
Announce the release via blog post (on Medium) and Twitter (linking to blog post).
|
||||
|
||||
8. Crack open a beer and wonder why we haven't yet automated this process. Cheers!
|
||||
|
2
go.mod
2
go.mod
@ -66,3 +66,5 @@ require (
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0-20170531160350-a96e63847dc3
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
)
|
||||
|
||||
replace github.com/kolide/kit => github.com/zwass/kit v0.0.0-20210625184505-ec5b5c5cce9c
|
||||
|
15
go.sum
15
go.sum
@ -170,6 +170,7 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4 h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-kit/kit v0.7.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk=
|
||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
@ -180,8 +181,10 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG
|
||||
github.com/go-redis/redis v6.15.8+incompatible h1:BKZuG6mCnRj5AOaWJXoCgf6rqTYnYJLe4en2hxT7r9o=
|
||||
github.com/go-redis/redis v6.15.8+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
||||
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
|
||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/go-stack/stack v1.7.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
|
||||
@ -267,6 +270,7 @@ github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5 h1:zIaiqGYDQwa4HVx5wG
|
||||
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v0.0.0-20161128191214-064e2069ce9c/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
@ -335,6 +339,7 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y
|
||||
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
|
||||
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
|
||||
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
|
||||
github.com/jmoiron/sqlx v0.0.0-20180406164412-2aeb6a910c2b/go.mod h1:IiEW3SEiiErVyFdH8NTuWjSifiEQKUoyK3LNqr2kCHU=
|
||||
github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA=
|
||||
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
|
||||
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
||||
@ -403,6 +408,7 @@ github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m
|
||||
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||
github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg=
|
||||
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/mattn/go-tty v0.0.3 h1:5OfyWorkyO7xP52Mq7tB36ajHDG5OHrmBGIS/DtakQI=
|
||||
@ -436,6 +442,7 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223 h1:F9x/1yl3T2
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/oklog/ulid v0.3.0/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||
github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
|
||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||
github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
||||
@ -450,6 +457,7 @@ github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME=
|
||||
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/open-policy-agent/opa v0.24.0 h1:fnGOIux+TTGZsC0du1bRBtV8F+KPN55Hks12uE3Fq3E=
|
||||
github.com/open-policy-agent/opa v0.24.0/go.mod h1:qEyD/i8j+RQettHGp4f86yjrjvv+ZYia+JHCMv2G7wA=
|
||||
github.com/opencensus-integrations/ocsql v0.1.1/go.mod h1:ozPYpNVBHZsX33jfoQPO5TlI5lqh0/3R36kirEqJKAM=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/patrickmn/sortutil v0.0.0-20120526081524-abeda66eb583 h1:+gFSK6FP5Ky3BPFrxQjHz92uRsj0DsrBL+xoIbiWRco=
|
||||
@ -539,6 +547,7 @@ github.com/spf13/viper v1.8.0/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
@ -572,6 +581,8 @@ github.com/zenazn/goji v0.9.0 h1:RSQQAbXGArQ0dIDEq+PI6WqN6if+5KHu6x2Cx/GXLTQ=
|
||||
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
|
||||
github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs=
|
||||
github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
|
||||
github.com/zwass/kit v0.0.0-20210625184505-ec5b5c5cce9c h1:TWQ2UvXPkhPxI2KmApKBOCaV6yD2N4mlvqFQ/DlPtpQ=
|
||||
github.com/zwass/kit v0.0.0-20210625184505-ec5b5c5cce9c/go.mod h1:OYYulo9tUqRadRLwB0+LE914sa1ui2yL7OrcU3Q/1XY=
|
||||
go.etcd.io/etcd/api/v3 v3.5.0 h1:GsV3S+OfZEOCNXdtNkBSR7kgLobAa/SO6tCxRa0GAYw=
|
||||
go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.0 h1:2aQv6F436YnN7I4VbI8PPYrBhu+SmrTaADcf8Mi/6PU=
|
||||
@ -580,6 +591,7 @@ go.etcd.io/etcd/client/v2 v2.305.0 h1:ftQ0nOOHMcbMS3KIaDQ0g5Qcd6bhaBrQT6b89DfwLT
|
||||
go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.1/go.mod h1:Ap50jQcDJrx6rB6VgeeFPtuPIf3wMRvRfrfYDO6+BmA=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
@ -661,6 +673,7 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
@ -728,6 +741,7 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@ -870,6 +884,7 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
||||
google.golang.org/appengine v1.6.2/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
|
||||
|
14
tools/docker/fleet.Dockerfile
Normal file
14
tools/docker/fleet.Dockerfile
Normal file
@ -0,0 +1,14 @@
|
||||
FROM alpine
|
||||
MAINTAINER Fleet Developers <hello@fleetdm.com>
|
||||
|
||||
RUN apk --update add ca-certificates
|
||||
|
||||
# Create fleet group and user
|
||||
RUN addgroup -S fleet && adduser -S fleet -G fleet
|
||||
|
||||
USER fleet
|
||||
|
||||
COPY fleet /usr/bin/
|
||||
COPY fleetctl /usr/bin/
|
||||
|
||||
CMD ["fleet", "serve"]
|
13
tools/docker/fleetctl.Dockerfile
Normal file
13
tools/docker/fleetctl.Dockerfile
Normal file
@ -0,0 +1,13 @@
|
||||
FROM alpine
|
||||
MAINTAINER Fleet Developers <hello@fleetdm.com>
|
||||
|
||||
RUN apk --update add ca-certificates
|
||||
|
||||
# Create fleet group and user
|
||||
RUN addgroup -S fleet && adduser -S fleet -G fleet
|
||||
|
||||
USER fleet
|
||||
|
||||
COPY fleetctl /usr/bin/
|
||||
|
||||
ENTRYPOINT ["fleetctl"]
|
@ -1,44 +1,49 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const child = require('child_process');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const child = require("child_process");
|
||||
const fs = require("fs");
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
|
||||
const axios = require('axios');
|
||||
const rimraf = require('rimraf');
|
||||
const tar = require('tar');
|
||||
const axios = require("axios");
|
||||
const rimraf = require("rimraf");
|
||||
const tar = require("tar");
|
||||
|
||||
const { version } = require('./package.json');
|
||||
const { version } = require("./package.json");
|
||||
|
||||
const binDir = path.join(__dirname, 'install');
|
||||
// Strip any v4.0.0-1 style suffix (but not -rc1) so that the correct package is
|
||||
// downloaded if there is a mistake in the NPM publish and we need to release a
|
||||
// -1, etc. (because NPM packages are immutable and can't be fixed after a mistake).
|
||||
const strippedVersion = version.replace(/-[0-9]+/i, "");
|
||||
|
||||
const binDir = path.join(__dirname, "install");
|
||||
// Determine the install directory by version so that we can detect when we need
|
||||
// to upgrade to a new version.
|
||||
const installDir = path.join(binDir, version);
|
||||
|
||||
const platform = () => {
|
||||
switch (os.type()) {
|
||||
case 'Windows_NT':
|
||||
return 'windows';
|
||||
case 'Linux':
|
||||
return 'linux';
|
||||
case 'Darwin':
|
||||
return 'macos';
|
||||
case "Windows_NT":
|
||||
return "windows";
|
||||
case "Linux":
|
||||
return "linux";
|
||||
case "Darwin":
|
||||
return "macos";
|
||||
default:
|
||||
throw new Error(`platform ${os.type} unrecognized`);
|
||||
}
|
||||
};
|
||||
|
||||
const binName = platform() === 'windows' ? 'fleetctl.exe' : 'fleetctl';
|
||||
const binName = platform() === "windows" ? "fleetctl.exe" : "fleetctl";
|
||||
const binPath = path.join(installDir, binName);
|
||||
|
||||
const install = async () => {
|
||||
const url = `https://github.com/fleetdm/fleet/releases/download/${version}/fleetctl-${platform()}.tar.gz`;
|
||||
|
||||
const url = `https://github.com/fleetdm/fleet/releases/download/${strippedVersion}/fleetctl_${strippedVersion}_${platform()}.tar.gz`;
|
||||
|
||||
fs.mkdirSync(installDir, { recursive: true });
|
||||
|
||||
try {
|
||||
const response = await axios({ url, responseType: 'stream' });
|
||||
const response = await axios({ url, responseType: "stream" });
|
||||
|
||||
// Strip the outer directory when extracting. Just get the binary.
|
||||
const tarWriter = tar.extract({ strip: 1, cwd: installDir });
|
||||
@ -46,13 +51,12 @@ const install = async () => {
|
||||
|
||||
// Need to return a promise with the writer to ensure we can await for it to complete.
|
||||
return new Promise((resolve, reject) => {
|
||||
tarWriter.on('finish', resolve);
|
||||
tarWriter.on('error', reject);
|
||||
tarWriter.on("finish", resolve);
|
||||
tarWriter.on("error", reject);
|
||||
});
|
||||
} catch (err) {
|
||||
throw new Error(`download archive ${url}: ${err.message}`);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const run = async () => {
|
||||
@ -66,11 +70,11 @@ const run = async () => {
|
||||
console.error(`Failed to install: ${err.message}`);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('Install completed.');
|
||||
console.log("Install completed.");
|
||||
}
|
||||
|
||||
const [, , ...args] = process.argv;
|
||||
const options = { cwd: process.cwd(), stdio: 'inherit' };
|
||||
const options = { cwd: process.cwd(), stdio: "inherit" };
|
||||
const { status, error } = child.spawnSync(binPath, args, options);
|
||||
|
||||
if (error) {
|
||||
|
Loading…
Reference in New Issue
Block a user