Skip to content

Commit 7db01d9

Browse files
Merge pull request #73 from interlynk-io/feature/modernize-actions
modernize github actions
2 parents 1f00e01 + 00630fb commit 7db01d9

File tree

9 files changed

+192
-144
lines changed

9 files changed

+192
-144
lines changed

.github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: GHCR Publishing
1+
name: Release | Build GHCR image
22
on:
33
release:
4-
types:
5-
- created
4+
types: [published]
5+
workflow_dispatch:
66

77
env:
88
REGISTRY: ghcr.io
@@ -38,7 +38,7 @@ jobs:
3838
uses: docker/build-push-action@v2
3939
with:
4040
context: .
41-
platforms: linux/amd64,linux/arm64
41+
platforms: linux/amd64
4242
push: true
4343
tags: ${{ steps.meta.outputs.tags }}
4444
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/release.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
name: releaser
1+
name: Release | Build Binary
22

33
on:
44
push:
55
tags:
66
- 'v*'
7+
workflow_dispatch:
78

89
jobs:
910
releaser:
@@ -21,6 +22,10 @@ jobs:
2122
go-version: '>=1.20'
2223
check-latest: true
2324
cache: true
25+
- name: Download syft binary
26+
run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
27+
- name: Run syft
28+
run: syft version
2429
- name: Goreleaser
2530
uses: goreleaser/goreleaser-action@v4
2631
with:

.github/workflows/sbom.yml

-36
This file was deleted.

.github/workflows/sbom_dev.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Dev | Build SBOM
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'main'
7+
pull_request:
8+
branches-ignore:
9+
- 'main'
10+
workflow_dispatch:
11+
12+
env:
13+
TOOL_NAME: ${{ github.repository }}
14+
SUPPLIER_NAME: Interlynk
15+
SUPPLIER_URL: https://interlynk.io
16+
DEFAULT_TAG: v0.0.1
17+
PYLYNK_TEMP_DIR: $RUNNER_TEMP/pylynk
18+
SBOM_TEMP_DIR: $RUNNER_TEMP/sbom
19+
SBOM_ENV: development
20+
MS_SBOM_TOOL_URL: https://github.com/microsoft/sbom-tool/releases/latest/download/sbom-tool-linux-x64
21+
MS_SBOM_SBOM_PATH: $RUNNER_TEMP/sbom/_manifest/spdx_2.2/manifest.spdx.json
22+
SBOM_EXCLUDE_DIRS: "**/samples/**"
23+
24+
25+
jobs:
26+
build-sbom:
27+
name: Build SBOM
28+
runs-on: ubuntu-latest
29+
permissions:
30+
id-token: write
31+
contents: write
32+
steps:
33+
- name: Checkout Repository
34+
uses: actions/checkout@v3
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Get Tag
39+
id: get_tag
40+
run: echo "LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo 'v0.0.1')" >> $GITHUB_ENV
41+
42+
43+
- name: Set up Python
44+
uses: actions/setup-python@v4
45+
with:
46+
python-version: '3.x' # Specify the Python version needed
47+
48+
- name: Checkout Python SBOM tool
49+
run: |
50+
git clone https://github.com/interlynk-io/pylynk.git ${{ env.PYLYNK_TEMP_DIR }}
51+
cd ${{ env.PYLYNK_TEMP_DIR }}
52+
git fetch --tags
53+
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
54+
git checkout $latest_tag
55+
echo "Checked out pylynk at tag: $latest_tag"
56+
57+
- name: Install Python dependencies
58+
run: |
59+
cd ${{ env.PYLYNK_TEMP_DIR }}
60+
pip install -r requirements.txt
61+
62+
- name: Generate SBOM
63+
shell: bash
64+
run: |
65+
cd ${{ github.workspace }}
66+
mkdir -p ${{ env.SBOM_TEMP_DIR}}
67+
curl -Lo $RUNNER_TEMP/sbom-tool ${{ env.MS_SBOM_TOOL_URL }}
68+
chmod +x $RUNNER_TEMP/sbom-tool
69+
$RUNNER_TEMP/sbom-tool generate -b ${{ env.SBOM_TEMP_DIR }} -bc . -pn ${{ env.TOOL_NAME }} -pv ${{ env.LATEST_TAG }} -ps ${{ env.SUPPLIER_NAME}} -nsb ${{ env.SUPPLIER_URL }} -cd "--DirectoryExclusionList ${{ env.SBOM_EXCLUDE_DIRS }}"
70+
71+
- name: Upload SBOM
72+
run: |
73+
python3 ${{ env.PYLYNK_TEMP_DIR }}/pylynk.py --verbose upload --prod ${{env.TOOL_NAME}} --env ${{ env.SBOM_ENV }} --sbom ${{ env.MS_SBOM_SBOM_PATH }} --token ${{ secrets.INTERLYNK_SECURITY_TOKEN }}
74+

.github/workflows/sbom_release.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Release | Build SBOM
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
env:
9+
TOOL_NAME: ${{ github.repository }}
10+
SUPPLIER_NAME: Interlynk
11+
SUPPLIER_URL: https://interlynk.io
12+
DEFAULT_TAG: v0.0.1
13+
PYLYNK_TEMP_DIR: $RUNNER_TEMP/pylynk
14+
SBOM_TEMP_DIR: $RUNNER_TEMP/sbom
15+
SBOM_ENV: default
16+
MS_SBOM_TOOL_URL: https://github.com/microsoft/sbom-tool/releases/latest/download/sbom-tool-linux-x64
17+
MS_SBOM_SBOM_PATH: $RUNNER_TEMP/sbom/_manifest/spdx_2.2/manifest.spdx.json
18+
SBOM_EXCLUDE_DIRS: "**/samples/**"
19+
20+
jobs:
21+
build-sbom:
22+
name: Build SBOM
23+
runs-on: ubuntu-latest
24+
permissions:
25+
id-token: write
26+
contents: write
27+
steps:
28+
- name: Checkout Repository
29+
uses: actions/checkout@v3
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Get Tag
34+
id: get_tag
35+
run: echo "LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo 'v0.0.1')" >> $GITHUB_ENV
36+
37+
- name: Set up Python
38+
uses: actions/setup-python@v4
39+
with:
40+
python-version: "3.x" # Specify the Python version needed
41+
42+
- name: Checkout Python SBOM tool
43+
run: |
44+
git clone https://github.com/interlynk-io/pylynk.git ${{ env.PYLYNK_TEMP_DIR }}
45+
cd ${{ env.PYLYNK_TEMP_DIR }}
46+
git fetch --tags
47+
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
48+
git checkout $latest_tag
49+
echo "Checked out pylynk at tag: $latest_tag"
50+
51+
- name: Install Python dependencies
52+
run: |
53+
cd ${{ env.PYLYNK_TEMP_DIR }}
54+
pip install -r requirements.txt
55+
56+
- name: Generate SBOM
57+
shell: bash
58+
run: |
59+
cd ${{ github.workspace }}
60+
mkdir -p ${{ env.SBOM_TEMP_DIR}}
61+
curl -Lo $RUNNER_TEMP/sbom-tool ${{ env.MS_SBOM_TOOL_URL }}
62+
chmod +x $RUNNER_TEMP/sbom-tool
63+
$RUNNER_TEMP/sbom-tool generate -b ${{ env.SBOM_TEMP_DIR }} -bc . -pn ${{ env.TOOL_NAME }} -pv ${{ env.LATEST_TAG }} -ps ${{ env.SUPPLIER_NAME}} -nsb ${{ env.SUPPLIER_URL }} -cd "--DirectoryExclusionList ${{ env.SBOM_EXCLUDE_DIRS }}"
64+
65+
- name: Upload SBOM
66+
run: |
67+
python3 ${{ env.PYLYNK_TEMP_DIR }}/pylynk.py --verbose upload --prod ${{env.TOOL_NAME}} --env ${{ env.SBOM_ENV }} --sbom ${{ env.MS_SBOM_SBOM_PATH }} --token ${{ secrets.INTERLYNK_SECURITY_TOKEN }}

.github/workflows/scorecard.yml

-72
This file was deleted.

Dockerfile

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
1-
FROM golang:1.20-alpine AS builder
1+
FROM golang:1.22.2-alpine AS builder
22
LABEL org.opencontainers.image.source="https://github.com/interlynk-io/sbomgr"
33

44
RUN apk add --no-cache make git
55
WORKDIR /app
66
COPY go.mod go.sum ./
77
RUN go mod download
88
COPY . .
9+
910
RUN make ; make build
1011

1112
FROM scratch
1213
LABEL org.opencontainers.image.source="https://github.com/interlynk-io/sbomgr"
13-
LABEL org.opencontainers.image.description="SBOM Grep - Search through SBOMs"
14+
LABEL org.opencontainers.image.description="Search through SBOMs"
1415
LABEL org.opencontainers.image.licenses=Apache-2.0
1516

17+
COPY --from=builder /bin/sh /bin/grep /bin/busybox /bin/touch /bin/chmod /bin/mkdir /bin/date /bin/cat /bin/
18+
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
19+
COPY --from=builder /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1
20+
COPY --from=builder /tmp /tmp
21+
COPY --from=builder /usr/bin /usr/bin
22+
23+
# Copy our static executable
1624
COPY --from=builder /app/build/sbomgr /app/sbomgr
17-
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
1825

19-
ENTRYPOINT [ "/app/sbomgr" ]
26+
# Disable version check
27+
ENV INTERLYNK_DISABLE_VERSION_CHECK=true
28+
29+
ENTRYPOINT [ "/app/sbomgr" ]

go.mod

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ go 1.21
55
toolchain go1.21.5
66

77
require (
8-
github.com/CycloneDX/cyclonedx-go v0.8.0
8+
github.com/CycloneDX/cyclonedx-go v0.9.0
99
github.com/google/go-github/v52 v52.0.0
1010
github.com/google/uuid v1.6.0
1111
github.com/olekukonko/tablewriter v0.0.5
12-
github.com/spdx/tools-golang v0.5.4
13-
github.com/spf13/cobra v1.8.0
12+
github.com/spdx/tools-golang v0.5.5
13+
github.com/spf13/cobra v1.8.1
1414
go.uber.org/zap v1.27.0
1515
gopkg.in/yaml.v2 v2.4.0
16-
sigs.k8s.io/release-utils v0.8.1
16+
sigs.k8s.io/release-utils v0.8.2
1717
)
1818

1919
require (
@@ -24,7 +24,7 @@ require (
2424
require (
2525
github.com/Masterminds/semver/v3 v3.2.1
2626
github.com/ProtonMail/go-crypto v1.0.0 // indirect
27-
github.com/cloudflare/circl v1.3.8 // indirect
27+
github.com/cloudflare/circl v1.3.9 // indirect
2828
github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be // indirect
2929
github.com/google/go-querystring v1.1.0 // indirect
3030
github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -33,9 +33,9 @@ require (
3333
github.com/spdx/gordf v0.0.0-20221230105357-b735bd5aac89 // indirect
3434
github.com/spf13/pflag v1.0.5 // indirect
3535
go.uber.org/multierr v1.11.0 // indirect
36-
golang.org/x/crypto v0.22.0 // indirect
37-
golang.org/x/oauth2 v0.19.0 // indirect
38-
golang.org/x/sys v0.19.0 // indirect
36+
golang.org/x/crypto v0.25.0 // indirect
37+
golang.org/x/oauth2 v0.21.0 // indirect
38+
golang.org/x/sys v0.22.0 // indirect
3939
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
4040
sigs.k8s.io/yaml v1.4.0 // indirect
4141
)

0 commit comments

Comments
 (0)