Skip to content

Commit

Permalink
✨ gcp snapshot connection for v9
Browse files Browse the repository at this point in the history
Fixes #1613
Fixes #1627

Signed-off-by: Christian Zunker <[email protected]>
  • Loading branch information
czunker committed Sep 8, 2023
1 parent f3781a2 commit 8640469
Show file tree
Hide file tree
Showing 48 changed files with 521 additions and 533 deletions.
326 changes: 0 additions & 326 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
project_name: cnquery
env:
- CGO_ENABLED=0
before:
hooks:
- make providers
builds:
- id: linux
main: ./apps/cnquery/cnquery.go
Expand All @@ -16,331 +13,8 @@ builds:
- linux
goarch:
- amd64
- 386
- arm64
- arm
- ppc64le
# ARM 6= Raspberry Pi A, A+, B, B+, Zero
# ARM 7= Raspberry Pi 2, 3, 4
goarm:
- 6
- 7
flags:
- -tags="production netgo"
ldflags:
- "-extldflags=-static"
- -s -w -X go.mondoo.com/cnquery.Version={{.Version}} -X go.mondoo.com/cnquery.Build={{.ShortCommit}} -X go.mondoo.com/cnquery.Date={{.Date}}
- id: macos
main: ./apps/cnquery/cnquery.go
binary: cnquery
goos:
- darwin
goarch:
- amd64
- arm64
flags: -tags production
ldflags:
# clang + macos does not support static: - -extldflags "-static"
- -s -w -X go.mondoo.com/cnquery.Version={{.Version}} -X go.mondoo.com/cnquery.Build={{.ShortCommit}} -X go.mondoo.com/cnquery.Date={{.Date}}
hooks:
post:
- cmd: /tmp/quill sign-and-notarize "{{ .Path }}" -vv || true
env:
- QUILL_LOG_FILE=/tmp/quill-{{ .Target }}.log
- id: windows
main: ./apps/cnquery/cnquery.go
binary: cnquery
goos:
- windows
goarch:
- amd64
- arm64
# -buildmode exe is required since go 1.15.0 https://github.com/golang/go/issues/40795
flags: -tags production -buildmode exe
ldflags:
- "-extldflags -static"
- -s -w -X go.mondoo.com/cnquery.Version={{.Version}} -X go.mondoo.com/cnquery.Build={{.ShortCommit}} -X go.mondoo.com/cnquery.Date={{.Date}}
hooks:
post:
- cmd: ./scripts/windows-upx.sh "{{ .Path }}"
output: true
env:
- TARGET={{ .Target }}
- cmd: jsign --storetype DIGICERTONE --alias "{{ .Env.SM_CERT_ALIAS }}" --storepass "{{ .Env.SM_API_KEY }}|{{ .Env.SM_CLIENT_CERT_FILE}}|{{ .Env.SM_CLIENT_CERT_PASSWORD }}" --tsaurl "http://timestamp.digicert.com" '{{ .Path }}'
nfpms:
-
maintainer: Mondoo <[email protected]>
description: Cloud-Native Asset Inventory Framework
homepage: https://mondoo.com/
vendor: Mondoo, Inc
license: MPL-2.0
formats:
- deb
- rpm
rpm:
signature:
key_file: '{{ .Env.GPG_KEY_PATH }}'
archives:
- id: releases
format_overrides:
- goos: windows
format: zip
files:
- none*
checksum:
name_template: '{{ .ProjectName }}_v{{ .Version }}_SHA256SUMS'
algorithm: sha256
snapshot:
name_template: "{{ .Tag }}-snapshot"
changelog:
use: github-native
dockers: # https://goreleaser.com/customization/docker/
# UBI containers
- use: buildx
goos: linux
goarch: amd64
dockerfile: Dockerfile-ubi
image_templates:
- "mondoo/{{ .ProjectName }}:{{ .Version }}-ubi-amd64"
- "mondoo/{{ .ProjectName }}:{{ .Major }}-ubi-amd64"
- "mondoo/{{ .ProjectName }}:latest-ubi-amd64"
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--target=root"
- use: buildx
goos: linux
goarch: arm64
dockerfile: Dockerfile-ubi
image_templates:
- "mondoo/{{ .ProjectName }}:{{ .Version }}-ubi-arm64"
- "mondoo/{{ .ProjectName }}:{{ .Major }}-ubi-arm64"
- "mondoo/{{ .ProjectName }}:latest-ubi-arm64"
build_flag_templates:
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--target=root"
# Standard containers
- use: buildx
goos: linux
goarch: amd64
image_templates:
- "mondoo/{{ .ProjectName }}:{{ .Version }}-amd64"
- "mondoo/{{ .ProjectName }}:{{ .Major }}-amd64"
- "mondoo/{{ .ProjectName }}:latest-amd64"
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--target=root"
- use: buildx
goos: linux
goarch: arm64
image_templates:
- "mondoo/{{ .ProjectName }}:{{ .Version }}-arm64v8"
- "mondoo/{{ .ProjectName }}:{{ .Major }}-arm64v8"
- "mondoo/{{ .ProjectName }}:latest-arm64v8"
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--target=root"
- use: buildx
goos: linux
goarch: arm
goarm: 6
image_templates:
- "mondoo/{{ .ProjectName }}:{{ .Version }}-armv6"
- "mondoo/{{ .ProjectName }}:{{ .Major }}-armv6"
- "mondoo/{{ .ProjectName }}:latest-armv6"
build_flag_templates:
- "--platform=linux/arm/v6"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--target=root"
- use: buildx
goos: linux
goarch: arm
goarm: 7
image_templates:
- "mondoo/{{ .ProjectName }}:{{ .Version }}-armv7"
- "mondoo/{{ .ProjectName }}:{{ .Major }}-armv7"
- "mondoo/{{ .ProjectName }}:latest-armv7"
build_flag_templates:
- "--platform=linux/arm/v7"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--target=root"
# Rootless
# UBI containers
- use: buildx
goos: linux
goarch: amd64
dockerfile: Dockerfile-ubi
image_templates:
- "mondoo/{{ .ProjectName }}:{{ .Version }}-ubi-amd64-rootless"
- "mondoo/{{ .ProjectName }}:{{ .Major }}-ubi-amd64-rootless"
- "mondoo/{{ .ProjectName }}:latest-ubi-amd64-rootless"
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--target=rootless"
- use: buildx
goos: linux
goarch: arm64
dockerfile: Dockerfile-ubi
image_templates:
- "mondoo/{{ .ProjectName }}:{{ .Version }}-ubi-arm64-rootless"
- "mondoo/{{ .ProjectName }}:{{ .Major }}-ubi-arm64-rootless"
- "mondoo/{{ .ProjectName }}:latest-ubi-arm64-rootless"
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--target=rootless"
# Standard containers
- use: buildx
goos: linux
goarch: amd64
image_templates:
- "mondoo/{{ .ProjectName }}:{{ .Version }}-amd64-rootless"
- "mondoo/{{ .ProjectName }}:{{ .Major }}-amd64-rootless"
- "mondoo/{{ .ProjectName }}:latest-amd64-rootless"
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--target=rootless"
- use: buildx
goos: linux
goarch: arm64
image_templates:
- "mondoo/{{ .ProjectName }}:{{ .Version }}-arm64v8-rootless"
- "mondoo/{{ .ProjectName }}:{{ .Major }}-arm64v8-rootless"
- "mondoo/{{ .ProjectName }}:latest-arm64v8-rootless"
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--target=rootless"
- use: buildx
goos: linux
goarch: arm
goarm: 6
image_templates:
- "mondoo/{{ .ProjectName }}:{{ .Version }}-armv6-rootless"
- "mondoo/{{ .ProjectName }}:{{ .Major }}-armv6-rootless"
- "mondoo/{{ .ProjectName }}:latest-armv6-rootless"
build_flag_templates:
- "--platform=linux/arm/v6"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--target=rootless"
- use: buildx
goos: linux
goarch: arm
goarm: 7
image_templates:
- "mondoo/{{ .ProjectName }}:{{ .Version }}-armv7-rootless"
- "mondoo/{{ .ProjectName }}:{{ .Major }}-armv7-rootless"
- "mondoo/{{ .ProjectName }}:latest-armv7-rootless"
build_flag_templates:
- "--platform=linux/arm/v7"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--target=rootless"
docker_manifests: # https://goreleaser.com/customization/docker_manifest/
# UBI containers
- name_template: mondoo/{{ .ProjectName }}:{{ .Version }}-ubi
image_templates:
- mondoo/{{ .ProjectName }}:{{ .Version }}-ubi-amd64
- mondoo/{{ .ProjectName }}:{{ .Version }}-ubi-arm64
- name_template: mondoo/{{ .ProjectName }}:{{ .Major }}-ubi
image_templates:
- mondoo/{{ .ProjectName }}:{{ .Major }}-ubi-amd64
- mondoo/{{ .ProjectName }}:{{ .Major }}-ubi-arm64
- name_template: mondoo/{{ .ProjectName }}:latest
image_templates:
- mondoo/{{ .ProjectName }}:latest-amd64
- mondoo/{{ .ProjectName }}:latest-arm64v8
- mondoo/{{ .ProjectName }}:latest-armv6
- mondoo/{{ .ProjectName }}:latest-armv7
# Standard containers
- name_template: mondoo/{{ .ProjectName }}:{{ .Version }}
image_templates:
- mondoo/{{ .ProjectName }}:{{ .Version }}-amd64
- mondoo/{{ .ProjectName }}:{{ .Version }}-arm64v8
- mondoo/{{ .ProjectName }}:{{ .Version }}-armv6
- mondoo/{{ .ProjectName }}:{{ .Version }}-armv7
- name_template: mondoo/{{ .ProjectName }}:{{ .Major }}
image_templates:
- mondoo/{{ .ProjectName }}:{{ .Major }}-amd64
- mondoo/{{ .ProjectName }}:{{ .Major }}-arm64v8
- mondoo/{{ .ProjectName }}:{{ .Major }}-armv6
- mondoo/{{ .ProjectName }}:{{ .Major }}-armv7
- name_template: mondoo/{{ .ProjectName }}:latest
image_templates:
- mondoo/{{ .ProjectName }}:latest-amd64
- mondoo/{{ .ProjectName }}:latest-arm64v8
- mondoo/{{ .ProjectName }}:latest-armv6
- mondoo/{{ .ProjectName }}:latest-armv7
# Rootless
# UBI containers
- name_template: mondoo/{{ .ProjectName }}:{{ .Version }}-ubi-rootless
image_templates:
- mondoo/{{ .ProjectName }}:{{ .Version }}-ubi-amd64-rootless
- mondoo/{{ .ProjectName }}:{{ .Version }}-ubi-arm64-rootless
- name_template: mondoo/{{ .ProjectName }}:{{ .Major }}-ubi-rootless
image_templates:
- mondoo/{{ .ProjectName }}:{{ .Major }}-ubi-amd64-rootless
- mondoo/{{ .ProjectName }}:{{ .Major }}-ubi-arm64-rootless
- name_template: mondoo/{{ .ProjectName }}:latest-ubi-rootless
image_templates:
- mondoo/{{ .ProjectName }}:latest-ubi-amd64-rootless
- mondoo/{{ .ProjectName }}:latest-ubi-arm64-rootless
# Standard containers
- name_template: mondoo/{{ .ProjectName }}:{{ .Version }}-rootless
image_templates:
- mondoo/{{ .ProjectName }}:{{ .Version }}-amd64-rootless
- mondoo/{{ .ProjectName }}:{{ .Version }}-arm64v8-rootless
- mondoo/{{ .ProjectName }}:{{ .Version }}-armv6-rootless
- mondoo/{{ .ProjectName }}:{{ .Version }}-armv7-rootless
- name_template: mondoo/{{ .ProjectName }}:{{ .Major }}-rootless
image_templates:
- mondoo/{{ .ProjectName }}:{{ .Major }}-amd64-rootless
- mondoo/{{ .ProjectName }}:{{ .Major }}-arm64v8-rootless
- mondoo/{{ .ProjectName }}:{{ .Major }}-armv6-rootless
- mondoo/{{ .ProjectName }}:{{ .Major }}-armv7-rootless
- name_template: mondoo/{{ .ProjectName }}:latest-rootless
image_templates:
- mondoo/{{ .ProjectName }}:latest-amd64-rootless
- mondoo/{{ .ProjectName }}:latest-arm64v8-rootless
- mondoo/{{ .ProjectName }}:latest-armv6-rootless
- mondoo/{{ .ProjectName }}:latest-armv7-rootless
12 changes: 10 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@
"type": "go",
"request": "attach",
"mode": "remote",
"debugAdapter": "dlv-dap",
"remotePath": "${workspaceFolder}",
"port": 2345,
"host": "127.0.0.1"
"port": 12345,
"host": "34.78.60.75",
"substitutePath":[
{
"from": "${workspaceFolder}",
"to": "/home/christian/workspace/cnquery"
}
]
]
},
{
"name": "Launch Package",
Expand Down
21 changes: 0 additions & 21 deletions _motor/providers/os/snapshot/localcmd.go

This file was deleted.

Loading

0 comments on commit 8640469

Please sign in to comment.