Skip to content

Commit

Permalink
workflows: updating workflows to contains amr64 (#702)
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Martins <nathan.martins@zup.com.br>
(cherry picked from commit ea8f83d)
  • Loading branch information
nathanmartinszup committed Dec 14, 2021
1 parent dc22cc0 commit 51bdb7d
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 66 deletions.
93 changes: 71 additions & 22 deletions .github/workflows/alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ jobs:
with:
go-version: 1.17

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Docker Login
uses: docker/login-action@v1
with:
Expand All @@ -64,6 +70,7 @@ jobs:
context: .
file: ./deployments/Dockerfile
tags: horuszup/horusec-cli:alpha
platforms: linux/amd64,linux/arm64

- name: Sign image
run: |
Expand Down Expand Up @@ -104,40 +111,70 @@ jobs:
-X 'github.com/ZupIT/horusec/cmd/app/version.Version=alpha' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Commit=${{ github.sha }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Date=${{ steps.date.outputs.date }}'" \
-o ./tmp/horusec_linux_x64_stand_alone ./cmd/app/main.go
-o ./tmp/horusec_linux_amd64_stand_alone ./cmd/app/main.go
cosign sign-blob -key=$COSIGN_KEY_LOCATION \
-output=./tmp/horusec_linux_amd64_stand_alone.sig ./tmp/horusec_linux_amd64_stand_alone
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags \
"-X 'github.com/ZupIT/horusec/config/dist.standAlone=true' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Version=alpha' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Commit=${{ github.sha }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Date=${{ steps.date.outputs.date }}'" \
-o ./tmp/horusec_linux_arm64_stand_alone ./cmd/app/main.go
cosign sign-blob -key=$COSIGN_KEY_LOCATION \
-output=./tmp/horusec_linux_x64_stand_alone.sig ./tmp/horusec_linux_x64_stand_alone
-output=./tmp/horusec_linux_arm64_stand_alone.sig ./tmp/horusec_linux_arm64_stand_alone
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags \
"-X 'github.com/ZupIT/horusec/config/dist.standAlone=true' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Version=alpha' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Commit=${{ github.sha }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Date=${{ steps.date.outputs.date }}'" \
-o ./tmp/horusec_windows_x86_stand_alone.exe ./cmd/app/main.go
-o ./tmp/horusec_win_x86_stand_alone.exe ./cmd/app/main.go
cosign sign-blob -key=$COSIGN_KEY_LOCATION \
-output=./tmp/horusec_windows_x86_stand_alone.exe.sig ./tmp/horusec_windows_x86_stand_alone.exe
-output=./tmp/horusec_win_x86_stand_alone.exe.sig ./tmp/horusec_win_x86_stand_alone.exe
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags \
"-X 'github.com/ZupIT/horusec/config/dist.standAlone=true' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Version=alpha' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Commit=${{ github.sha }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Date=${{ steps.date.outputs.date }}'" \
-o ./tmp/horusec_windows_x64_stand_alone.exe ./cmd/app/main.go
-o ./tmp/horusec_win_amd64_stand_alone.exe ./cmd/app/main.go
cosign sign-blob -key=$COSIGN_KEY_LOCATION \
-output=./tmp/horusec_windows_x64_stand_alone.exe.sig ./tmp/horusec_windows_x64_stand_alone.exe
-output=./tmp/horusec_win_amd64_stand_alone.exe.sig ./tmp/horusec_win_amd64_stand_alone.exe
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -ldflags \
"-X 'github.com/ZupIT/horusec/config/dist.standAlone=true' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Version=alpha' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Commit=${{ github.sha }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Date=${{ steps.date.outputs.date }}'" \
-o ./tmp/horusec_win_arm64_stand_alone.exe ./cmd/app/main.go
cosign sign-blob -key=$COSIGN_KEY_LOCATION \
-output=./tmp/horusec_win_arm64_stand_alone.exe.sig ./tmp/horusec_win_arm64_stand_alone.exe
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags \
"-X 'github.com/ZupIT/horusec/config/dist.standAlone=true' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Version=alpha' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Commit=${{ github.sha }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Date=${{ steps.date.outputs.date }}'" \
-o ./tmp/horusec_mac_x64_stand_alone ./cmd/app/main.go
-o ./tmp/horusec_mac_amd64_stand_alone ./cmd/app/main.go
cosign sign-blob -key=$COSIGN_KEY_LOCATION \
-output=./tmp/horusec_mac_amd64_stand_alone.sig ./tmp/horusec_mac_amd64_stand_alone
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags \
"-X 'github.com/ZupIT/horusec/config/dist.standAlone=true' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Version=alpha' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Commit=${{ github.sha }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Date=${{ steps.date.outputs.date }}'" \
-o ./tmp/horusec_mac_arm64_stand_alone ./cmd/app/main.go
cosign sign-blob -key=$COSIGN_KEY_LOCATION \
-output=./tmp/horusec_mac_x64_stand_alone.sig ./tmp/horusec_mac_x64_stand_alone
-output=./tmp/horusec_mac_arm64_stand_alone.sig ./tmp/horusec_mac_arm64_stand_alone
env:
COSIGN_PASSWORD: ${{ secrets.COSIGN_PWD }}

Expand All @@ -164,26 +201,38 @@ jobs:
checksums.txt:./dist/checksums.txt
checksums.txt.sig:./dist/checksums.txt.sig
cosign.pub:./deployments/cosign.pub
horusec_linux_x64:./dist/horusec_linux_amd64/horusec
horusec_linux_x64.sig:./dist/horusec_linux_amd64/horusec.sig
horusec_linux_amd64:./dist/horusec_linux_amd64/horusec
horusec_linux_amd64.sig:./dist/horusec_linux_amd64/horusec.sig
horusec_linux_x86:./dist/horusec_linux_386/horusec
horusec_linux_x86.sig:./dist/horusec_linux_386/horusec.sig
horusec_mac_x64:./dist/horusec_darwin_amd64/horusec
horusec_mac_x64.sig:./dist/horusec_darwin_amd64/horusec.sig
horusec_win_x64.exe:./dist/horusec_windows_amd64/horusec.exe
horusec_win_x64.exe.sig:./dist/horusec_windows_amd64/horusec.exe.sig
horusec_mac_amd64:./dist/horusec_darwin_amd64/horusec
horusec_mac_amd64.sig:./dist/horusec_darwin_amd64/horusec.sig
horusec_win_amd64.exe:./dist/horusec_windows_amd64/horusec.exe
horusec_win_amd64.exe.sig:./dist/horusec_windows_amd64/horusec.exe.sig
horusec_win_x86.exe:./dist/horusec_windows_386/horusec.exe
horusec_win_x86.exe.sig:./dist/horusec_windows_386/horusec.exe.sig
horusec_linux_arm64:./dist/horusec_linux_arm64/horusec
horusec_linux_arm64.sig:./dist/horusec_linux_arm64/horusec.sig
horusec_win_arm64.exe:./dist/horusec_windows_arm64/horusec.exe
horusec_win_arm64.exe.sig:./dist/horusec_windows_arm64/horusec.exe.sig
horusec_mac_arm64:./dist/horusec_darwin_arm64/horusec
horusec_mac_arm64.sig:./dist/horusec_darwin_arm64/horusec.sig
horusec_linux_x86_stand_alone:./tmp/horusec_linux_x86_stand_alone
horusec_linux_x86_stand_alone.sig:./tmp/horusec_linux_x86_stand_alone.sig
horusec_linux_x64_stand_alone:./tmp/horusec_linux_x64_stand_alone
horusec_linux_x64_stand_alone.sig:./tmp/horusec_linux_x64_stand_alone.sig
horusec_windows_x86_stand_alone.exe:./tmp/horusec_windows_x86_stand_alone.exe
horusec_windows_x86_stand_alone.exe.sig:./tmp/horusec_windows_x86_stand_alone.exe.sig
horusec_windows_x64_stand_alone.exe:./tmp/horusec_windows_x64_stand_alone.exe
horusec_windows_x64_stand_alone.exe.sig:./tmp/horusec_windows_x64_stand_alone.exe.sig
horusec_mac_x64_stand_alone:./tmp/horusec_mac_x64_stand_alone
horusec_mac_x64_stand_alone.sig:./tmp/horusec_mac_x64_stand_alone.sig
horusec_linux_amd64_stand_alone:./tmp/horusec_linux_amd64_stand_alone
horusec_linux_amd64_stand_alone.sig:./tmp/horusec_linux_amd64_stand_alone.sig
horusec_win_x86_stand_alone.exe:./tmp/horusec_win_x86_stand_alone.exe
horusec_win_x86_stand_alone.exe.sig:./tmp/horusec_win_x86_stand_alone.exe.sig
horusec_win_amd64_stand_alone.exe:./tmp/horusec_win_amd64_stand_alone.exe
horusec_win_amd64_stand_alone.exe.sig:./tmp/horusec_win_amd64_stand_alone.exe.sig
horusec_mac_amd64_stand_alone:./tmp/horusec_mac_amd64_stand_alone
horusec_mac_amd64_stand_alone.sig:./tmp/horusec_mac_amd64_stand_alone.sig
horusec_linux_arm64_stand_alone:./tmp/horusec_linux_arm64_stand_alone
horusec_linux_arm64_stand_alone.sig:./tmp/horusec_linux_arm64_stand_alone.sig
horusec_win_arm64_stand_alone.exe:./tmp/horusec_win_arm64_stand_alone.exe
horusec_win_arm64_stand_alone.exe.sig:./tmp/horusec_win_arm64_stand_alone.exe.sig
horusec_mac_arm64_stand_alone:./tmp/horusec_mac_arm64_stand_alone
horusec_mac_arm64_stand_alone.sig:./tmp/horusec_mac_arm64_stand_alone.sig
body: |
## Docker images
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ jobs:
-X 'github.com/ZupIT/horusec/cmd/app/version.Version=${{ steps.updated-version.outputs.version }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Commit=${{ github.sha }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Date=${{ steps.date.outputs.date }}'" \
-o ./tmp/horusec_linux_x64_stand_alone ./cmd/app/main.go
-o ./tmp/horusec_linux_amd64_stand_alone ./cmd/app/main.go
cosign sign-blob -key=$COSIGN_KEY_LOCATION \
-output=./tmp/horusec_linux_x64_stand_alone.sig ./tmp/horusec_linux_x64_stand_alone
-output=./tmp/horusec_linux_amd64_stand_alone.sig ./tmp/horusec_linux_amd64_stand_alone
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags \
"-X 'github.com/ZupIT/horusec/config/dist.standAlone=true' \
Expand All @@ -106,40 +106,40 @@ jobs:
-X 'github.com/ZupIT/horusec/cmd/app/version.Version=${{ steps.updated-version.outputs.version }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Commit=${{ github.sha }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Date=${{ steps.date.outputs.date }}'" \
-o ./tmp/horusec_windows_x86_stand_alone.exe ./cmd/app/main.go
-o ./tmp/horusec_win_x86_stand_alone.exe ./cmd/app/main.go
cosign sign-blob -key=$COSIGN_KEY_LOCATION \
-output=./tmp/horusec_windows_x86_stand_alone.exe.sig ./tmp/horusec_windows_x86_stand_alone.exe
-output=./tmp/horusec_win_x86_stand_alone.exe.sig ./tmp/horusec_win_x86_stand_alone.exe
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags \
"-X 'github.com/ZupIT/horusec/config/dist.standAlone=true' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Version=${{ steps.updated-version.outputs.version }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Commit=${{ github.sha }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Date=${{ steps.date.outputs.date }}'" \
-o ./tmp/horusec_windows_x64_stand_alone.exe ./cmd/app/main.go
-o ./tmp/horusec_win_amd64_stand_alone.exe ./cmd/app/main.go
cosign sign-blob -key=$COSIGN_KEY_LOCATION \
-output=./tmp/horusec_windows_x64_stand_alone.exe.sig ./tmp/horusec_windows_x64_stand_alone.exe
-output=./tmp/horusec_win_amd64_stand_alone.exe.sig ./tmp/horusec_win_amd64_stand_alone.exe
CGO_ENABLED=0 GOOS=windows GOARCH=arm64 go build -ldflags \
"-X 'github.com/ZupIT/horusec/config/dist.standAlone=true' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Version=${{ steps.updated-version.outputs.version }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Commit=${{ github.sha }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Date=${{ steps.date.outputs.date }}'" \
-o ./tmp/horusec_windows_arm64_stand_alone.exe ./cmd/app/main.go
-o ./tmp/horusec_win_arm64_stand_alone.exe ./cmd/app/main.go
cosign sign-blob -key=$COSIGN_KEY_LOCATION \
-output=./tmp/horusec_windows_arm64_stand_alone.exe.sig ./tmp/horusec_windows_x64_stand_alone.exe
-output=./tmp/horusec_win_arm64_stand_alone.exe.sig ./tmp/horusec_win_arm64_stand_alone.exe
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags \
"-X 'github.com/ZupIT/horusec/config/dist.standAlone=true' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Version=${{ steps.updated-version.outputs.version }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Commit=${{ github.sha }}' \
-X 'github.com/ZupIT/horusec/cmd/app/version.Date=${{ steps.date.outputs.date }}'" \
-o ./tmp/horusec_mac_x64_stand_alone ./cmd/app/main.go
-o ./tmp/horusec_mac_amd64_stand_alone ./cmd/app/main.go
cosign sign-blob -key=$COSIGN_KEY_LOCATION \
-output=./tmp/horusec_mac_x64_stand_alone.sig ./tmp/horusec_mac_x64_stand_alone
-output=./tmp/horusec_mac_amd64_stand_alone.sig ./tmp/horusec_mac_amd64_stand_alone
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags \
"-X 'github.com/ZupIT/horusec/config/dist.standAlone=true' \
Expand Down
6 changes: 2 additions & 4 deletions deployments/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ WORKDIR /horusec

RUN go get -t -v -d ./...

RUN env GOOS=linux GOARCH=amd64 go build -o /bin/horusec ./cmd/app/main.go
RUN env GOOS=linux go build -o /bin/horusec ./cmd/app/main.go

FROM docker:20.10.9

RUN apk add git
FROM docker:20.10-git

COPY --from=builder /bin/horusec /usr/local/bin
RUN chmod +x /usr/local/bin/horusec
Expand Down
5 changes: 1 addition & 4 deletions deployments/Dockerfile-gorelease
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM docker:20.10.8

RUN apk add git
FROM docker:20.10-git

COPY /horusec /usr/local/bin/horusec
RUN chmod +x /usr/local/bin/horusec

CMD [ "sh" ]
75 changes: 49 additions & 26 deletions goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ archives:
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
format: binary
replacements:
amd64: x64
amd64: amd64
386: x86
aarch64: arm64
arm64: arm64
darwin: mac
windows: win
checksum:
Expand All @@ -51,27 +51,27 @@ release:
- glob: deployments/cosign.pub
- glob: ./tmp/horusec_linux_x86_stand_alone
- glob: ./tmp/horusec_linux_x86_stand_alone.sig
- glob: ./tmp/horusec_linux_x64_stand_alone
- glob: ./tmp/horusec_linux_x64_stand_alone.sig
- glob: ./tmp/horusec_linux_amd64_stand_alone
- glob: ./tmp/horusec_linux_amd64_stand_alone.sig
- glob: ./tmp/horusec_linux_arm64_stand_alone
- glob: ./tmp/horusec_linux_arm64_stand_alone.sig
- glob: ./tmp/horusec_windows_x86_stand_alone.exe
- glob: ./tmp/horusec_windows_x86_stand_alone.exe.sig
- glob: ./tmp/horusec_windows_x64_stand_alone.exe
- glob: ./tmp/horusec_windows_x64_stand_alone.exe.sig
- glob: ./tmp/horusec_windows_arm64_stand_alone.exe
- glob: ./tmp/horusec_windows_arm64_stand_alone.exe.sig
- glob: ./tmp/horusec_mac_x64_stand_alone
- glob: ./tmp/horusec_mac_x64_stand_alone.sig
- glob: ./tmp/horusec_win_x86_stand_alone.exe
- glob: ./tmp/horusec_win_x86_stand_alone.exe.sig
- glob: ./tmp/horusec_win_amd64_stand_alone.exe
- glob: ./tmp/horusec_win_amd64_stand_alone.exe.sig
- glob: ./tmp/horusec_win_arm64_stand_alone.exe
- glob: ./tmp/horusec_win_arm64_stand_alone.exe.sig
- glob: ./tmp/horusec_mac_amd64_stand_alone
- glob: ./tmp/horusec_mac_amd64_stand_alone.sig
- glob: ./tmp/horusec_mac_arm64_stand_alone
- glob: ./tmp/horusec_mac_arm64_stand_alone.sig
nfpms:
- id: horusec
package_name: horusec
file_name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
replacements:
amd64: 64-bit
386: 32-bit
amd64: amd64
386: x86
arm64: arm64
darwin: mac
windows: win
Expand All @@ -90,26 +90,35 @@ nfpms:
signs:
- cmd: cosign
stdin: '{{ .Env.COSIGN_PWD }}'
args: ["sign-blob", "-key={{ .Env.COSIGN_KEY_LOCATION }}", "-output=${signature}", "${artifact}"]
args: [ "sign-blob", "-key={{ .Env.COSIGN_KEY_LOCATION }}", "-output=${signature}", "${artifact}" ]
artifacts: all
docker_signs:
- cmd: cosign
args: ["sign", "-key={{ .Env.COSIGN_KEY_LOCATION }}", "${artifact}"]
args: [ "sign", "-key={{ .Env.COSIGN_KEY_LOCATION }}", "${artifact}" ]
artifacts: all
stdin: '{{ .Env.COSIGN_PWD }}'
dockers:
- id: horusec
- image_templates:
- 'horuszup/horusec-cli:{{ .Tag }}-amd64'
skip_push: false
goos: linux
goarch:
- amd64
- arm64
ids:
- horusec
image_templates:
- "horuszup/horusec-cli:latest"
- "horuszup/horusec-cli:{{ .Tag }}"
- "horuszup/horusec-cli:v{{ .Major }}"
goarch: amd64
dockerfile: ./deployments/Dockerfile-gorelease
use: docker
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--platform=linux/amd64"
push_flags:
- --tls-verify=false
- image_templates:
- 'horuszup/horusec-cli:{{ .Tag }}-arm64'
skip_push: false
goos: linux
goarch: arm64
dockerfile: ./deployments/Dockerfile-gorelease
use: docker
build_flag_templates:
Expand All @@ -118,5 +127,19 @@ dockers:
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--platform=linux/arm64"
push_flags:
- --tls-verify=false
docker_manifests:
- name_template: 'horuszup/horusec-cli:{{ .Tag }}'
image_templates:
- 'horuszup/horusec-cli:{{ .Tag }}-amd64'
- 'horuszup/horusec-cli:{{ .Tag }}-arm64'
- name_template: 'horuszup/horusec-cli:latest'
image_templates:
- 'horuszup/horusec-cli:{{ .Tag }}-amd64'
- 'horuszup/horusec-cli:{{ .Tag }}-arm64'
- name_template: 'horuszup/horusec-cli:v{{ .Major }}'
image_templates:
- 'horuszup/horusec-cli:{{ .Tag }}-amd64'
- 'horuszup/horusec-cli:{{ .Tag }}-arm64'

0 comments on commit 51bdb7d

Please sign in to comment.