Skip to content

Commit

Permalink
chore: upgrade version script and pin github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
drcgjung committed Nov 15, 2023
1 parent baec622 commit a3e076c
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 33 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
# Get the Code
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive

Expand All @@ -97,7 +97,7 @@ jobs:
# Enable deployment access (on demand or main branch and version tags only)
- name: Login to GitHub Container Registry
if: ${{ ( github.event.inputs.deploy_docker == 'true' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }}
uses: docker/login-action@v2
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ steps.set-docker-repo.outputs.REGISTRY }}
# Use existing DockerHub credentials present as secrets
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
# Create SemVer or ref tags dependent of trigger event
- name: Docker Meta Conforming
id: meta-conf
uses: docker/metadata-action@v4
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: |
${{ steps.set-docker-repo.outputs.REPO }}/conforming-agent
Expand All @@ -142,7 +142,7 @@ jobs:
# build in any case, but push only main and version tag settings
- name: Conforming Container Build and Push
uses: docker/build-push-action@v3
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: conforming/.
file: conforming/src/main/docker/Dockerfile
Expand All @@ -154,7 +154,7 @@ jobs:
# Important step to push image description to DockerHub - since this is version independent, we always take it from main
- name: Update Docker Hub description for Conforming Agent
if: ${{ steps.set-docker-repo.outputs.REPO == 'docker.io' && github.ref == 'refs/heads/main' }}
uses: peter-evans/dockerhub-description@v3
uses: peter-evans/dockerhub-description@dc67fad7001ef9e8e3c124cb7a64e16d0a63d864 # v3.4.2
with:
readme-filepath: conforming/README.md
username: ${{ secrets.DOCKER_HUB_USER || github.actor }}
Expand All @@ -164,7 +164,7 @@ jobs:
# Create SemVer or ref tags dependent of trigger event
- name: Docker Meta Remoting
id: meta-remote
uses: docker/metadata-action@v4
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: |
${{ steps.set-docker-repo.outputs.REPO }}/remoting-agent
Expand All @@ -181,7 +181,7 @@ jobs:
# build in any case, but push only main and version tag settings
- name: Remoting Container Build and Push
uses: docker/build-push-action@v3
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: remoting/.
file: remoting/src/main/docker/Dockerfile
Expand All @@ -193,7 +193,7 @@ jobs:
# Important step to push image description to DockerHub - since this is version independent, we always take it from main
- name: Update Docker Hub description for Remoting Agent
if: ${{ steps.set-docker-repo.outputs.REPO == 'docker.io' && github.ref == 'refs/heads/main' }}
uses: peter-evans/dockerhub-description@v3
uses: peter-evans/dockerhub-description@dc67fad7001ef9e8e3c124cb7a64e16d0a63d864 # v3.4.2
with:
readme-filepath: remoting/README.md
username: ${{ secrets.DOCKER_HUB_USER || github.actor }}
Expand All @@ -203,7 +203,7 @@ jobs:
# Create SemVer or ref tags dependent of trigger event
- name: Docker Meta Provisioning
id: meta-prov
uses: docker/metadata-action@v4
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: |
${{ steps.set-docker-repo.outputs.REPO }}/provisioning-agent
Expand All @@ -220,7 +220,7 @@ jobs:
# build in any case, but push only main and version tag settings
- name: Provisioning Container Build and Push
uses: docker/build-push-action@v3
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: provisioning/.
file: provisioning/src/main/docker/Dockerfile
Expand All @@ -232,7 +232,7 @@ jobs:
# Important step to push image description to DockerHub - since this is version independent, we always take it from main
- name: Update Docker Hub description for Provisioning Agent
if: ${{ steps.set-docker-repo.outputs.REPO == 'docker.io' && github.ref == 'refs/heads/main' }}
uses: peter-evans/dockerhub-description@v3
uses: peter-evans/dockerhub-description@dc67fad7001ef9e8e3c124cb7a64e16d0a63d864 # v3.4.2
with:
readme-filepath: provisioning/README.md
username: ${{ secrets.DOCKER_HUB_USER || github.actor }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/helm-chart-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v3
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
version: v3.10.3

- uses: ./.github/actions/setup-java

Check warning on line 70 in .github/workflows/helm-chart-lint.yml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Unpinned Actions Full Length Commit SHA

Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload. When selecting a SHA, you should verify it is from the action's repository and not a repository fork.

- uses: actions/setup-python@v4
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: 3.9

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.3.1
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1

- name: Run chart-testing (lint)
run: ct lint --target-branch ${{ github.base_ref || github.ref_name }} --config charts/config/chart-testing-config.yaml
Expand All @@ -89,7 +89,7 @@ jobs:
# Preparing a kind cluster to install and test charts on
- name: Create kind cluster
uses: container-tools/kind-action@v1
uses: container-tools/kind-action@61f1afd4807b0dac84f3232ec99e45c63701d220 # v2.0.1
with:
# upgrade version, default (v0.17.0) uses node image v1.21.1 and doesn't work with more recent node image versions
version: v0.19.0
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/helm-chart-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

Expand All @@ -51,11 +51,11 @@ jobs:
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v3
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.4.1
uses: helm/chart-releaser-action@a917fd15b20e8b64b94d9158ad54cd6345335584 # v1.6.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
7 changes: 4 additions & 3 deletions .github/workflows/kics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ jobs:
security-events: write

steps:
- uses: actions/[email protected]
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1


#
# Take out
Expand All @@ -58,7 +59,7 @@ jobs:
# - the "Administrative Boundaries" Info (e84eaf4d-2f45-47b2-abe8-e581b06deb66) would not be visible
#
- name: KICS scan
uses: checkmarx/[email protected]
uses: checkmarx/kics-github-action@8a44970e3d2eca668be41abe9d4e06709c3b3609 # v1.7.0
with:
path: "."
fail_on: high
Expand All @@ -69,6 +70,6 @@ jobs:

- name: Upload SARIF file for GitHub Advanced Security Dashboard
if: always()
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@689fdc5193eeb735ecb2e52e819e3382876f93f4 # v2.22.6
with:
sarif_file: kicsResults/results.sarif
15 changes: 8 additions & 7 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ jobs:
contents: read
security-events: write
steps:
- uses: actions/checkout@v3.5.2
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@master
uses: aquasecurity/trivy-action@2b6a709cf9c4025c5438138008beaddbb02086f0 # v0.14.0
with:
scan-type: "config"
# ignore-unfixed: true
Expand All @@ -65,7 +65,7 @@ jobs:
output: "trivy-results-config.sarif"
severity: "CRITICAL,HIGH"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@689fdc5193eeb735ecb2e52e819e3382876f93f4 # v2.22.6
if: always()
with:
sarif_file: "trivy-results-config.sarif"
Expand Down Expand Up @@ -100,12 +100,12 @@ jobs:
fi
exit 0
- uses: actions/checkout@v3.5.2
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

# Enable repository access (on main branch and version tags only)
- name: Login to GitHub Container Registry
if: ${{ ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }}
uses: docker/login-action@v2
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ steps.set-docker-repo.outputs.REGISTRY }}
# Use existing DockerHub credentials present as secrets
Expand All @@ -122,16 +122,17 @@ jobs:
## the next two steps will only execute if the image exists check was successful
- name: Run Trivy vulnerability scanner
if: success() && steps.imageCheck.outcome != 'failure'
uses: aquasecurity/trivy-action@master
uses: aquasecurity/trivy-action@2b6a709cf9c4025c5438138008beaddbb02086f0 # v0.14.0
with:
image-ref: "${{ steps.set-docker-repo.outputs.REPO }}/${{ matrix.image }}:${{ needs.git-sha7.outputs.value }}"
format: "sarif"
output: "trivy-results-${{ matrix.image }}.sarif"
exit-code: "1"
severity: "CRITICAL,HIGH"
timeout: "10m0s"

- name: Upload Trivy scan results to GitHub Security tab
if: success() && steps.imageCheck.outcome != 'failure'
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@689fdc5193eeb735ecb2e52e819e3382876f93f4 # v2.22.6
with:
sarif_file: "trivy-results-${{ matrix.image }}.sarif"
8 changes: 4 additions & 4 deletions .github/workflows/veracode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
{dir: conforming, name: conforming-agent}]
steps:
# Set-Up
- uses: actions/checkout@v3.5.2
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./.github/actions/setup-java

Check warning on line 68 in .github/workflows/veracode.yml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Unpinned Actions Full Length Commit SHA

Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload. When selecting a SHA, you should verify it is from the action's repository and not a repository fork.
# Build
- name: Build ${{ matrix.variant.name }}
Expand All @@ -77,7 +77,7 @@ jobs:
run: |-
tar -czvf ${{ matrix.variant.dir }}/target/${{ matrix.variant.name }}.tar.gz ${{ matrix.variant.dir }}/target/${{ matrix.variant.name }}-*.jar
- name: Veracode Upload And Scan
uses: veracode/[email protected]
uses: veracode/veracode-uploadandscan-action@c3c0b78bddb42d5f6b10d70562f692215a410d7b #v1.0
if: |
needs.secret-presence.outputs.ORG_VERACODE_API_ID && needs.secret-presence.outputs.ORG_VERACODE_API_KEY
continue-on-error: true
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
variant: [{dir: provisioning, name: provisioning-agent}]
steps:
# Set-Up
- uses: actions/checkout@v3.5.2
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./.github/actions/setup-java

Check warning on line 111 in .github/workflows/veracode.yml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Unpinned Actions Full Length Commit SHA

Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload. When selecting a SHA, you should verify it is from the action's repository and not a repository fork.
# Build
- name: Build ${{ matrix.variant.name }}
Expand All @@ -120,7 +120,7 @@ jobs:
run: |-
tar --exclude='spring-web-5.3.28.jar' -czvf ${{ matrix.variant.dir }}/target/${{ matrix.variant.name }}.tar.gz ${{ matrix.variant.dir }}/target/lib/*.jar ${{ matrix.variant.dir }}/target/${{ matrix.variant.name }}-*.jar
- name: Veracode Upload And Scan
uses: veracode/[email protected]
uses: veracode/veracode-uploadandscan-action@c3c0b78bddb42d5f6b10d70562f692215a410d7b #v1.0
if: |
needs.secret-presence.outputs.ORG_VERACODE_API_ID && needs.secret-presence.outputs.ORG_VERACODE_API_KEY
continue-on-error: true
Expand Down
22 changes: 22 additions & 0 deletions upgrade_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

# Copyright (c) 2022,2023 Contributors to the Eclipse Foundation
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0

echo Upgrading from 10.1.5-SNAPSHOT to $1
PATTERN=s/10.1.5-SNAPSHOT/$1/g
LC_ALL=C
find ./ -type f \( -iname "*.xml" -o -iname "*.sh" -o -iname "*.yml" -o -iname "*.yaml" -o -iname "*.md" -o -iname "*.java" -o -iname "*.properties" \) -exec sed -i.bak $PATTERN {} \;

0 comments on commit a3e076c

Please sign in to comment.