Skip to content

Commit f938f3d

Browse files
author
Ron Sherfey
authored
Merge pull request #28 from SherfeyInv/snyk-fix-6718f5233ca148e8270ca2bf68e1df60
[Snyk] Fix for 2 vulnerabilities
2 parents 5e2f586 + 5b5da1b commit f938f3d

File tree

10 files changed

+321
-194
lines changed

10 files changed

+321
-194
lines changed

.github/workflows/docker-image.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Build the Docker image
18+
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)

.github/workflows/ibm.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# This workflow will build a docker container, publish it to IBM Container Registry, and deploy it to IKS when there is a push to the "master" branch.
2+
#
3+
# To configure this workflow:
4+
#
5+
# 1. Ensure that your repository contains a Dockerfile
6+
# 2. Setup secrets in your repository by going to settings: Create ICR_NAMESPACE and IBM_CLOUD_API_KEY
7+
# 3. Change the values for the IBM_CLOUD_REGION, REGISTRY_HOSTNAME, IMAGE_NAME, IKS_CLUSTER, DEPLOYMENT_NAME, and PORT
8+
9+
name: Build and Deploy to IKS
10+
11+
on:
12+
push:
13+
branches: [ "master" ]
14+
15+
# Environment variables available to all jobs and steps in this workflow
16+
env:
17+
GITHUB_SHA: ${{ github.sha }}
18+
IBM_CLOUD_API_KEY: ${{ secrets.IBM_CLOUD_API_KEY }}
19+
IBM_CLOUD_REGION: us-south
20+
ICR_NAMESPACE: ${{ secrets.ICR_NAMESPACE }}
21+
REGISTRY_HOSTNAME: us.icr.io
22+
IMAGE_NAME: iks-test
23+
IKS_CLUSTER: example-iks-cluster-name-or-id
24+
DEPLOYMENT_NAME: iks-test
25+
PORT: 5001
26+
27+
jobs:
28+
setup-build-publish-deploy:
29+
name: Setup, Build, Publish, and Deploy
30+
runs-on: ubuntu-latest
31+
environment: production
32+
steps:
33+
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
# Download and Install IBM Cloud CLI
38+
- name: Install IBM Cloud CLI
39+
run: |
40+
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
41+
ibmcloud --version
42+
ibmcloud config --check-version=false
43+
ibmcloud plugin install -f kubernetes-service
44+
ibmcloud plugin install -f container-registry
45+
46+
# Authenticate with IBM Cloud CLI
47+
- name: Authenticate with IBM Cloud CLI
48+
run: |
49+
ibmcloud login --apikey "${IBM_CLOUD_API_KEY}" -r "${IBM_CLOUD_REGION}" -g default
50+
ibmcloud cr region-set "${IBM_CLOUD_REGION}"
51+
ibmcloud cr login
52+
53+
# Build the Docker image
54+
- name: Build with Docker
55+
run: |
56+
docker build -t "$REGISTRY_HOSTNAME"/"$ICR_NAMESPACE"/"$IMAGE_NAME":"$GITHUB_SHA" \
57+
--build-arg GITHUB_SHA="$GITHUB_SHA" \
58+
--build-arg GITHUB_REF="$GITHUB_REF" .
59+
60+
# Push the image to IBM Container Registry
61+
- name: Push the image to ICR
62+
run: |
63+
docker push $REGISTRY_HOSTNAME/$ICR_NAMESPACE/$IMAGE_NAME:$GITHUB_SHA
64+
65+
# Deploy the Docker image to the IKS cluster
66+
- name: Deploy to IKS
67+
run: |
68+
ibmcloud ks cluster config --cluster $IKS_CLUSTER
69+
kubectl config current-context
70+
kubectl create deployment $DEPLOYMENT_NAME --image=$REGISTRY_HOSTNAME/$ICR_NAMESPACE/$IMAGE_NAME:$GITHUB_SHA --dry-run -o yaml > deployment.yaml
71+
kubectl apply -f deployment.yaml
72+
kubectl rollout status deployment/$DEPLOYMENT_NAME
73+
kubectl create service loadbalancer $DEPLOYMENT_NAME --tcp=80:$PORT --dry-run -o yaml > service.yaml
74+
kubectl apply -f service.yaml
75+
kubectl get services -o wide

.github/workflows/npm-grunt.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: NodeJS with Grunt
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [14.x, 16.x, 18.x]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
25+
- name: Build
26+
run: |
27+
npm install
28+
grunt

azure-pipelines.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Docker
2+
# Build a Docker image
3+
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
4+
5+
trigger:
6+
- master
7+
8+
resources:
9+
- repo: self
10+
11+
variables:
12+
tag: '$(Build.BuildId)'
13+
14+
stages:
15+
- stage: Build
16+
displayName: Build image
17+
jobs:
18+
- job: Build
19+
displayName: Build
20+
pool:
21+
vmImage: ubuntu-latest
22+
steps:
23+
- task: Docker@2
24+
displayName: Build an image
25+
inputs:
26+
command: build
27+
dockerfile: '$(Build.SourcesDirectory)/src/examples/java/Dockerfile'
28+
tags: |
29+
$(tag)

src/examples/java/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<dependency>
2929
<groupId>net.sf.saxon</groupId>
3030
<artifactId>Saxon-HE</artifactId>
31-
<version>10.8</version>
31+
<version>10.9</version>
3232
</dependency>
3333
</dependencies>
3434

src/examples/javascript/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
FROM node:18.20.3-slim
2-
31
WORKDIR /code/src/examples/javascript
42
ADD package.json /code/src/examples/javascript/package.json
53
ADD package-lock.json /code/src/examples/javascript/package-lock.json

src/examples/javascript/package-lock.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/examples/python/requirements.txt

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
#
55
# pip-compile --output-file=requirements.txt requirements.in
66
#
7-
appdirs==1.4.4
8-
# via black
97
attrs==21.2.0
108
# via pytest
11-
black==21.7b0
9+
black==24.3.0
1210
# via -r requirements.in
1311
click==8.0.1
1412
# via
@@ -22,24 +20,24 @@ mypy-extensions==0.4.3
2220
# via
2321
# black
2422
# mypy
25-
packaging==21.0
26-
# via pytest
23+
packaging==24.0
24+
# via
25+
# black
26+
# pytest
2727
pathspec==0.9.0
2828
# via black
2929
pep517==0.11.0
3030
# via pip-tools
3131
pip-tools==6.2.0
3232
# via -r requirements.in
33+
platformdirs==4.2.0
34+
# via black
3335
pluggy==0.13.1
3436
# via pytest
35-
py==1.10.0
37+
py==1.11.0
3638
# via pytest
37-
pyparsing==2.4.7
38-
# via packaging
3939
pytest==6.2.4
4040
# via -r requirements.in
41-
regex==2021.7.6
42-
# via black
4341
toml==0.10.2
4442
# via
4543
# mypy
@@ -48,11 +46,15 @@ tomli==1.1.0
4846
# via
4947
# black
5048
# pep517
51-
typing-extensions==3.10.0.0
52-
# via mypy
49+
typing-extensions==4.10.0
50+
# via
51+
# black
52+
# mypy
5353
wheel==0.38.0
5454
# via pip-tools
5555

5656
# The following packages are considered to be unsafe in a requirements file:
5757
# pip
5858
# setuptools
59+
setuptools>=70.0.0 # not directly required, pinned by Snyk to avoid a vulnerability
60+
zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability

0 commit comments

Comments
 (0)