|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +name: generate sboms |
| 19 | + |
| 20 | +on: |
| 21 | + push: |
| 22 | + tags: |
| 23 | + - '[0-9]+.[0-9]+.[0-9]+*' |
| 24 | + workflow_dispatch: |
| 25 | + |
| 26 | +permissions: |
| 27 | + contents: read |
| 28 | + |
| 29 | +jobs: |
| 30 | + ui-sbom: |
| 31 | + name: ui sbom |
| 32 | + runs-on: ubuntu-24.04 |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
| 35 | + with: |
| 36 | + persist-credentials: false |
| 37 | + |
| 38 | + - name: Generate UI SBOM |
| 39 | + uses: sbomify/sbomify-action@master |
| 40 | + env: |
| 41 | + LOCK_FILE: ui/package-lock.json |
| 42 | + OUTPUT_FILE: sbom.ui.cdx.json |
| 43 | + COMPONENT_NAME: cloudstack-ui |
| 44 | + COMPONENT_VERSION: ${{ github.ref_name }} |
| 45 | + UPLOAD: false |
| 46 | + ENRICH: true |
| 47 | + |
| 48 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 49 | + with: |
| 50 | + name: sbom-ui |
| 51 | + path: sbom.ui.cdx.json |
| 52 | + |
| 53 | + java-sbom: |
| 54 | + name: java sbom |
| 55 | + runs-on: ubuntu-24.04 |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
| 58 | + with: |
| 59 | + persist-credentials: false |
| 60 | + |
| 61 | + - name: Setup Environment |
| 62 | + uses: ./.github/actions/setup-env |
| 63 | + |
| 64 | + - name: Generate Java SBOM |
| 65 | + run: mvn -B -ntp -Dnoredist org.cyclonedx:cyclonedx-maven-plugin:makeAggregateBom |
| 66 | + |
| 67 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 68 | + with: |
| 69 | + name: sbom-java |
| 70 | + path: target/ACS.sbom.* |
| 71 | + |
| 72 | + marvin-sbom: |
| 73 | + name: marvin sbom |
| 74 | + runs-on: ubuntu-24.04 |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
| 77 | + with: |
| 78 | + persist-credentials: false |
| 79 | + |
| 80 | + - name: Setup Environment |
| 81 | + uses: ./.github/actions/setup-env |
| 82 | + with: |
| 83 | + install-python: 'true' |
| 84 | + |
| 85 | + - name: Resolve marvin dependencies |
| 86 | + run: | |
| 87 | + # marvin's `packages` list includes the generated marvin.cloudstackAPI |
| 88 | + # module, which is created at build time from the API spec and isn't |
| 89 | + # checked in, so setup.py can't be built directly. Read the declared |
| 90 | + # install_requires instead of building the package. |
| 91 | + python3 -c " |
| 92 | + import ast |
| 93 | + tree = ast.parse(open('tools/marvin/setup.py').read()) |
| 94 | + for node in ast.walk(tree): |
| 95 | + if isinstance(node, ast.Call) and getattr(node.func, 'id', None) == 'setup': |
| 96 | + for kw in node.keywords: |
| 97 | + if kw.arg == 'install_requires': |
| 98 | + for elt in kw.value.elts: |
| 99 | + print(elt.value) |
| 100 | + " > marvin-install-requires.txt |
| 101 | + python3 -m venv marvin-venv |
| 102 | + marvin-venv/bin/pip install --quiet -r marvin-install-requires.txt |
| 103 | + marvin-venv/bin/pip freeze > marvin-requirements.txt |
| 104 | +
|
| 105 | + - name: Generate marvin SBOM |
| 106 | + uses: sbomify/sbomify-action@master |
| 107 | + env: |
| 108 | + LOCK_FILE: marvin-requirements.txt |
| 109 | + OUTPUT_FILE: sbom.marvin.cdx.json |
| 110 | + COMPONENT_NAME: cloudstack-marvin |
| 111 | + COMPONENT_VERSION: ${{ github.ref_name }} |
| 112 | + UPLOAD: false |
| 113 | + ENRICH: true |
| 114 | + |
| 115 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 116 | + with: |
| 117 | + name: sbom-marvin |
| 118 | + path: sbom.marvin.cdx.json |
0 commit comments