Skip to content

Commit abe8547

Browse files
committed
Updated workflow examples to use Socket Container
1 parent 8faf84a commit abe8547

File tree

5 files changed

+52
-17
lines changed

5 files changed

+52
-17
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66

77
[project]
88
name = "socketsecurity"
9-
version = "2.1.24"
9+
version = "2.1.25"
1010
requires-python = ">= 3.10"
1111
license = {"file" = "LICENSE"}
1212
dependencies = [

socketsecurity/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
__author__ = 'socket.dev'
2-
__version__ = '2.1.24'
2+
__version__ = '2.1.25'

workflows/bitbucket-pipelines.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22
# This pipeline runs Socket Security scans on every commit to any branch
33
# The CLI automatically detects most information from the git repository
44

5-
image: python:3.12-slim
5+
image: socketdev/cli:latest
66

77
definitions:
88
steps:
99
- step: &socket-scan
1010
name: Socket Security Scan
11-
caches:
12-
- pip
1311
script:
14-
- pip install --upgrade pip
15-
- pip install socketsecurity
12+
# Socket CLI is pre-installed in the socketdev/cli:latest image
13+
# Git is also pre-installed for auto-detection features
14+
- socketcli --version
1615
# Run Socket CLI with minimal required parameters
1716
# The CLI automatically detects:
1817
# - Repository name from git

workflows/github-actions.yml

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,15 @@ jobs:
2626
pull-requests: write
2727
runs-on: ubuntu-latest
2828

29+
# Option 1: Use the official Socket CLI container (faster, more reliable)
30+
container: socketdev/cli:latest
31+
2932
steps:
3033
- uses: actions/checkout@v4
3134
with:
3235
# For PRs, fetch one additional commit for proper diff analysis
3336
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
3437

35-
- uses: actions/setup-python@v5
36-
with:
37-
python-version: '3.12'
38-
39-
- name: Install Socket CLI
40-
run: pip install socketsecurity --upgrade
41-
4238
- name: Run Socket Security Scan
4339
env:
4440
SOCKET_SECURITY_API_KEY: ${{ secrets.SOCKET_SECURITY_API_KEY }}
@@ -65,3 +61,42 @@ jobs:
6561
--target-path $GITHUB_WORKSPACE \
6662
--scm github \
6763
--pr-number $PR_NUMBER
64+
65+
# Alternative Option 2: Traditional Python setup (if you prefer not to use containers)
66+
# Replace the job above with this version if you want to use the traditional approach:
67+
#
68+
# socket-security:
69+
# permissions:
70+
# issues: write
71+
# contents: read
72+
# pull-requests: write
73+
# runs-on: ubuntu-latest
74+
#
75+
# steps:
76+
# - uses: actions/checkout@v4
77+
# with:
78+
# fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
79+
#
80+
# - uses: actions/setup-python@v5
81+
# with:
82+
# python-version: '3.12'
83+
#
84+
# - name: Install Socket CLI
85+
# run: pip install socketsecurity --upgrade
86+
#
87+
# - name: Run Socket Security Scan
88+
# env:
89+
# SOCKET_SECURITY_API_KEY: ${{ secrets.SOCKET_SECURITY_API_KEY }}
90+
# GH_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
# run: |
92+
# PR_NUMBER=0
93+
# if [ "${{ github.event_name }}" == "pull_request" ]; then
94+
# PR_NUMBER=${{ github.event.pull_request.number }}
95+
# elif [ "${{ github.event_name }}" == "issue_comment" ]; then
96+
# PR_NUMBER=${{ github.event.issue.number }}
97+
# fi
98+
#
99+
# socketcli \
100+
# --target-path $GITHUB_WORKSPACE \
101+
# --scm github \
102+
# --pr-number $PR_NUMBER

workflows/gitlab-ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ stages:
77

88
socket-security:
99
stage: security-scan
10-
image: python:3.12-slim
10+
image: socketdev/cli:latest
1111

1212
# Run on all branches and merge requests
1313
rules:
@@ -24,8 +24,9 @@ socket-security:
2424
- .cache/pip/
2525

2626
before_script:
27-
- pip install --upgrade pip
28-
- pip install socketsecurity
27+
# Socket CLI is pre-installed in the socketdev/cli:latest image
28+
# Git is also pre-installed for auto-detection features
29+
- socketcli --version
2930

3031
script:
3132
# Run Socket CLI with minimal required parameters

0 commit comments

Comments
 (0)