Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update legacy-release_sbom-generator.yaml #29584

Closed
wants to merge 22 commits into from
Closed
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b995b02
Update legacy-release_sbom-generator.yaml
rsh1k Aug 14, 2024
c80d082
Update legacy-release_sbom-generator.yaml
rsh1k Aug 14, 2024
b3f246e
Update legacy-release_sbom-generator.yaml
rsh1k Aug 14, 2024
4cf9a2c
Update legacy-release_sbom-generator.yaml
rsh1k Aug 15, 2024
7be3dca
Update legacy-release_sbom-generator.yaml
rsh1k Aug 15, 2024
f16d56a
Update legacy-release_sbom-generator.yaml
rsh1k Aug 15, 2024
8b12ef5
Update legacy-release_sbom-generator.yaml
rsh1k Aug 15, 2024
e27b3c7
Update legacy-release_sbom-generator.yaml
rsh1k Aug 15, 2024
d5e81fc
Update legacy-release_sbom-generator.yaml
rsh1k Aug 15, 2024
24d859e
Update legacy-release_sbom-generator.yaml
rsh1k Aug 15, 2024
1679c61
Update legacy-release_sbom-generator.yaml
rsh1k Aug 15, 2024
10b3d7a
Update legacy-release_sbom-generator.yaml
rsh1k Aug 15, 2024
4a9cde8
Update legacy-release_sbom-generator.yaml
rsh1k Aug 15, 2024
9866621
Update legacy-release_sbom-generator.yaml
rsh1k Aug 15, 2024
07dc637
Merge branch 'master' into rashik1144-patch-7
mbiuki Aug 15, 2024
201a656
Merge branch 'master' into rashik1144-patch-7
mbiuki Aug 15, 2024
c06b0fd
Merge branch 'master' into rashik1144-patch-7
rsh1k Aug 16, 2024
4769cd2
Update legacy-release_sbom-generator.yaml
rsh1k Aug 19, 2024
d72d98e
Merge branch 'master' into rashik1144-patch-7
rsh1k Aug 19, 2024
1a64b0c
Merge branch 'master' into rashik1144-patch-7
rsh1k Aug 20, 2024
c37b8a7
Merge branch 'master' into rashik1144-patch-7
mbiuki Aug 23, 2024
d86e9a6
Merge branch 'master' into rashik1144-patch-7
rsh1k Aug 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 44 additions & 19 deletions .github/workflows/legacy-release_sbom-generator.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Generate SBOM for latest version of dotCMS and put into core-test-repo
#Generate SBOM for the latest dotCMS version
name: Generate and Commit SBOM

on:
release:
types: [published]
Expand All @@ -16,14 +18,14 @@ jobs:
contents: write # Ensure write access to contents

steps:
- name: Checkout core-test-results repository
- name: Checkout core repository
uses: actions/checkout@v3
with:
repository: dotCMS/core-test-results
repository: dotCMS/core
token: ${{ secrets.GITHUB_TOKEN }}
path: core-test-results
path: core

- name: Get dotCMS release version
- name: Get dotCMS release version and set the branch name based on formatted version
id: get_version
run: |
if [ "${{ github.event_name }}" == "release" ]; then
Expand All @@ -33,41 +35,64 @@ jobs:
# Use the input provided in manual run
latest_tag=${{ github.event.inputs.dotcms_version }}
fi
# Format the tag name: remove 'v' prefix
formatted_tag=$(echo "$latest_tag" | sed -e 's/^v//' -e 's/^dotcms-cli-//')
# Construct the branch name based on the formatted version
branch_name="release-${formatted_tag}"
echo "DOTCMS_VERSION=${formatted_tag}" >> $GITHUB_ENV
echo "BRANCH_NAME=${branch_name}" >> $GITHUB_ENV

rsh1k marked this conversation as resolved.
Show resolved Hide resolved
# Format the tag name if necessary
formatted_tag=$(echo "$latest_tag" | sed -e 's/^dotcms-cli-//' -e 's/^v//')

echo "Latest tag: $formatted_tag"
echo "DOTCMS_VERSION=$formatted_tag" >> $GITHUB_ENV
- name: Print environment variables
run: |
echo "DOTCMS_VERSION=${{ env.DOTCMS_VERSION }}"
echo "BRANCH_NAME=${{ env.BRANCH_NAME }}"

- name: Pull and run dotCMS Docker image
run: |
if [ -z "${{ env.DOTCMS_VERSION }}" ]; then
echo "Error: DOTCMS_VERSION is not set"
exit 1
fi
docker pull dotcms/dotcms:${{ env.DOTCMS_VERSION }}
docker run -d -p 8082:8082 dotcms/dotcms:${{ env.DOTCMS_VERSION }}

- name: Install pipx
run: |
pip install pipx


- name: Scan Docker Image with Syft
run: |
pipx run anchore_syft dotcms/dotcms:${{ env.DOTCMS_VERSION }} -o cyclonedx-xml > core-test-results/sbom/cyclonedx.json
pipx run anchore_syft dotcms/dotcms:${{ env.DOTCMS_VERSION }} -o cyclonedx-xml > core/sbom-cyclonedx.json


- name: Fetch all branches and list them
run: |
cd core
git fetch --all
git branch -a

- name: Check out the target branch
run: |
cd core
git fetch origin ${{ env.BRANCH_NAME }}
git checkout -b ${{ env.BRANCH_NAME }} origin/${{ env.BRANCH_NAME }} || { echo "Failed to checkout branch ${{ env.BRANCH_NAME }}"; exit 1; }

- name: Rename SBOM file with dotCMS version
- name: Confirm branch checkout
run: |
mkdir -p core-test-results/sbom
mv core-test-results/sbom/cyclonedx.json core-test-results/sbom/dotcms-${{ env.DOTCMS_VERSION }}.json
cd core
git status

- name: Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"

- name: Commit and push results to core-test-results repository
- name: Commit and push results to target branch
run: |
cd core-test-results
git add sbom/dotcms-${{ env.DOTCMS_VERSION }}.json
cd core
git add sbom-cyclonedx.json
git commit -m "Add SBOM for dotCMS version ${{ env.DOTCMS_VERSION }}" || echo "No changes to commit"
git push origin master
git push origin ${{ env.BRANCH_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading