|
| 1 | +# ci-enterprise.yaml |
| 2 | +# ######################################################################## |
| 3 | +# Copyright ... |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# 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, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# ######################################################################## |
| 17 | + |
| 18 | +name: ci-enterprise |
| 19 | +on: |
| 20 | + push: |
| 21 | + branches: |
| 22 | + - "main" |
| 23 | + pull_request: |
| 24 | + branches: |
| 25 | + - "enterprise/release" |
| 26 | + - "main" |
| 27 | + |
| 28 | +permissions: |
| 29 | + actions: read |
| 30 | + contents: write |
| 31 | + deployments: write |
| 32 | + packages: write |
| 33 | + |
| 34 | +jobs: |
| 35 | + meta: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + outputs: |
| 38 | + sc4s: ghcr.io/${{ github.repository }}/enterprise:${{ fromJSON(steps.docker_action_meta.outputs.json).labels['org.opencontainers.image.version'] }} |
| 39 | + container_tags: ${{ steps.docker_action_meta.outputs.tags }} |
| 40 | + container_labels: ${{ steps.docker_action_meta.outputs.labels }} |
| 41 | + container_buildtime: ${{ fromJSON(steps.docker_action_meta.outputs.json).labels['org.opencontainers.image.created'] }} |
| 42 | + container_version: ${{ fromJSON(steps.docker_action_meta.outputs.json).labels['org.opencontainers.image.version'] }} |
| 43 | + container_revision: ${{ fromJSON(steps.docker_action_meta.outputs.json).labels['org.opencontainers.image.revision'] }} |
| 44 | + container_base: ${{ fromJSON(steps.docker_action_meta.outputs.json).tags[0] }} |
| 45 | + matrix_supportedSplunk: ${{ steps.matrix.outputs.supportedSplunk }} |
| 46 | + steps: |
| 47 | + - name: Checkout |
| 48 | + uses: actions/checkout@v4 |
| 49 | + with: |
| 50 | + submodules: false |
| 51 | + persist-credentials: false |
| 52 | + |
| 53 | + - name: Setup Node.js |
| 54 | + uses: actions/setup-node@v4 |
| 55 | + with: |
| 56 | + node-version: 18 |
| 57 | + |
| 58 | + - name: Semantic Release |
| 59 | + id: version |
| 60 | + uses: cycjimmy/semantic-release-action@v3 |
| 61 | + with: |
| 62 | + semantic_version: 18 |
| 63 | + extra_plugins: | |
| 64 | + @semantic-release/exec |
| 65 | + @semantic-release/git |
| 66 | + semantic-release-helm |
| 67 | + |
| 68 | + |
| 69 | + dry_run: true |
| 70 | + env: |
| 71 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 72 | + |
| 73 | + # Append a trailing ".e" to the semantic-release version for enterprise builds. |
| 74 | + - name: Set Enterprise Version |
| 75 | + id: set_enterprise_version |
| 76 | + run: | |
| 77 | + NEW_VER="${{ steps.version.outputs.new_release_version }}" |
| 78 | + if [[ "$NEW_VER" != *.e ]]; then |
| 79 | + NEW_VER="${NEW_VER}.e" |
| 80 | + fi |
| 81 | + echo "enterprise_version=$NEW_VER" >> $GITHUB_OUTPUT |
| 82 | + echo "Using enterprise version: $NEW_VER" |
| 83 | +
|
| 84 | + - name: Docker meta |
| 85 | + id: docker_action_meta |
| 86 | + uses: docker/metadata-action@v5 |
| 87 | + with: |
| 88 | + images: ghcr.io/${{ github.repository }}/enterprise |
| 89 | + tags: | |
| 90 | + type=sha,format=long |
| 91 | + type=sha, |
| 92 | + type=raw,value=enterprise-latest |
| 93 | + type=semver,pattern={{version}},value=${{ steps.set_enterprise_version.outputs.enterprise_version }} |
| 94 | + type=semver,pattern={{major}},value=${{ steps.set_enterprise_version.outputs.enterprise_version }} |
| 95 | + type=semver,pattern={{major}}.{{minor}},value=${{ steps.set_enterprise_version.outputs.enterprise_version }} |
| 96 | + type=ref,event=pr,value=pr-${{ github.event.number }} |
| 97 | +
|
| 98 | + - name: matrix |
| 99 | + id: matrix |
| 100 | + |
| 101 | + |
| 102 | + security-fossa-scan: |
| 103 | + continue-on-error: true |
| 104 | + runs-on: ubuntu-latest |
| 105 | + steps: |
| 106 | + - uses: actions/checkout@v4 |
| 107 | + - name: run fossa analyze and create report |
| 108 | + run: | |
| 109 | + curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install-latest.sh | bash |
| 110 | + fossa analyze --debug |
| 111 | + fossa report attribution --format text > /tmp/THIRDPARTY |
| 112 | + env: |
| 113 | + FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }} |
| 114 | + - name: upload THIRDPARTY file |
| 115 | + uses: actions/upload-artifact@v4 |
| 116 | + with: |
| 117 | + name: THIRDPARTY |
| 118 | + path: /tmp/THIRDPARTY |
| 119 | + - name: run fossa test |
| 120 | + run: | |
| 121 | + fossa test --debug |
| 122 | + env: |
| 123 | + FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }} |
| 124 | + |
| 125 | + build_action: |
| 126 | + runs-on: ubuntu-latest |
| 127 | + name: Build Action |
| 128 | + needs: |
| 129 | + - meta |
| 130 | + steps: |
| 131 | + - name: Checkout |
| 132 | + uses: actions/checkout@v4 |
| 133 | + with: |
| 134 | + submodules: false |
| 135 | + persist-credentials: false |
| 136 | + - name: Set up QEMU |
| 137 | + uses: docker/setup-qemu-action@v3 |
| 138 | + - name: Set up Docker Buildx |
| 139 | + uses: docker/setup-buildx-action@v3 |
| 140 | + - name: Login to GitHub Packages Docker Registry |
| 141 | + uses: docker/login-action@v3 |
| 142 | + with: |
| 143 | + registry: ghcr.io |
| 144 | + username: ${{ github.actor }} |
| 145 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 146 | + - name: Build and push action |
| 147 | + id: docker_action_build |
| 148 | + uses: docker/build-push-action@v6 |
| 149 | + with: |
| 150 | + context: . |
| 151 | + provenance: false |
| 152 | + file: package/Dockerfile.enterprise |
| 153 | + platforms: linux/amd64,linux/arm64 |
| 154 | + push: true |
| 155 | + tags: ${{ needs.meta.outputs.container_base }} |
| 156 | + labels: ${{ needs.meta.outputs.container_labels }} |
| 157 | + build-args: | |
| 158 | + BUILDTIME=${{ needs.meta.outputs.container_buildtime }} |
| 159 | + VERSION=${{ needs.meta.outputs.container_version }} |
| 160 | + REVISION=${{ needs.meta.outputs.container_revision }} |
| 161 | + cache-from: type=registry,ref=${{ needs.meta.outputs.container_base }} |
| 162 | + cache-to: type=inline |
| 163 | + |
| 164 | + scan-docker-image-cves: |
| 165 | + runs-on: ubuntu-latest |
| 166 | + name: Scan docker image on CVEs |
| 167 | + needs: |
| 168 | + - meta |
| 169 | + - build_action |
| 170 | + steps: |
| 171 | + - name: Checkout |
| 172 | + uses: actions/checkout@v4 |
| 173 | + with: |
| 174 | + submodules: false |
| 175 | + persist-credentials: false |
| 176 | + - name: Run docker vulnerability scanner |
| 177 | + uses: aquasecurity/trivy-action@master |
| 178 | + with: |
| 179 | + image-ref: ${{ needs.meta.outputs.container_base }} |
| 180 | + format: 'table' |
| 181 | + exit-code: '1' |
| 182 | + severity: 'CRITICAL,HIGH,MEDIUM,LOW' |
| 183 | + trivyignores: '.trivyignore' |
| 184 | + scanners: "vuln" |
| 185 | + |
| 186 | + test-container: |
| 187 | + runs-on: ubuntu-latest |
| 188 | + needs: |
| 189 | + - meta |
| 190 | + - build_action |
| 191 | + container: |
| 192 | + image: python:3.9-buster |
| 193 | + services: |
| 194 | + splunk: |
| 195 | + image: splunk/splunk:${{ fromJson(needs.meta.outputs.matrix_supportedSplunk)[0].version }} |
| 196 | + ports: |
| 197 | + - 8000:8000 |
| 198 | + - 8088:8088 |
| 199 | + - 8089:8089 |
| 200 | + env: |
| 201 | + SPLUNK_HEC_TOKEN: 70b6ae71-76b3-4c38-9597-0c5b37ad9630 |
| 202 | + SPLUNK_PASSWORD: Changed@11 |
| 203 | + SPLUNK_START_ARGS: --accept-license |
| 204 | + SPLUNK_APPS_URL: https://github.com/splunk/splunk-configurations-base-indexes/releases/download/v1.0.0/splunk_configurations_base_indexes-1.0.0.tar.gz |
| 205 | + sc4s: |
| 206 | + image: ${{ needs.meta.outputs.container_base }} |
| 207 | + ports: |
| 208 | + - 514:514 |
| 209 | + - 601:601 |
| 210 | + - 5614:5514 |
| 211 | + - 5601:5601 |
| 212 | + - 6000:6000 |
| 213 | + - 6002:6002 |
| 214 | + - 9000:9000 |
| 215 | + env: |
| 216 | + SC4S_DEST_SPLUNK_HEC_DEFAULT_URL: https://splunk:8088 |
| 217 | + SC4S_DEST_SPLUNK_HEC_DEFAULT_TOKEN: 70b6ae71-76b3-4c38-9597-0c5b37ad9630 |
| 218 | + SC4S_DEST_SPLUNK_HEC_DEFAULT_TLS_VERIFY: "no" |
| 219 | + SC4S_DEST_SPLUNK_HEC_DEFAULT_HTTP_COMPRESSION: "yes" |
| 220 | + SC4S_LISTEN_PFSENSE_FIREWALL_TCP_PORT: 6000 |
| 221 | + SC4S_LISTEN_SIMPLE_TEST_ONE_TCP_PORT: 5514 |
| 222 | + SC4S_LISTEN_SIMPLE_TEST_ONE_UDP_PORT: 5514 |
| 223 | + SC4S_LISTEN_SIMPLE_TEST_TWO_TCP_PORT: 5601 |
| 224 | + SC4S_LISTEN_SPECTRACOM_NTP_TCP_PORT: 6002 |
| 225 | + SC4S_LISTEN_CISCO_ESA_TCP_PORT: 9000 |
| 226 | + SC4S_LISTEN_RARITAN_DSX_TCP_PORT: 9001 |
| 227 | + SC4S_LISTEN_CHECKPOINT_SPLUNK_NOISE_CONTROL: "yes" |
| 228 | + SC4S_SOURCE_RICOH_SYSLOG_FIXHOST: "yes" |
| 229 | + TEST_SC4S_ACTIVATE_EXAMPLES: "yes" |
| 230 | + SC4S_DEBUG_CONTAINER: "yes" |
| 231 | + SC4S_SOURCE_VMWARE_VSPHERE_GROUPMSG: "yes" |
| 232 | + SC4S_NETAPP_ONTAP_NEW_FORMAT: "yes" |
| 233 | + SC4S_USE_VPS_CACHE: "yes" |
| 234 | + steps: |
| 235 | + - name: Checkout |
| 236 | + uses: actions/checkout@v4 |
| 237 | + with: |
| 238 | + submodules: false |
| 239 | + persist-credentials: false |
| 240 | + - name: Run tests |
| 241 | + run: | |
| 242 | + pip3 install poetry |
| 243 | + poetry install |
| 244 | + mkdir -p test-results || true |
| 245 | + poetry run pytest -v --tb=long \ |
| 246 | + --splunk_type=external \ |
| 247 | + --splunk_hec_token=70b6ae71-76b3-4c38-9597-0c5b37ad9630 \ |
| 248 | + --splunk_host=splunk \ |
| 249 | + --sc4s_host=sc4s \ |
| 250 | + --junitxml=test-results/test.xml \ |
| 251 | + -n 14 \ |
| 252 | + -k 'not lite and not name_cache' |
| 253 | + test-ipv4-name-cache: |
| 254 | + runs-on: ubuntu-latest |
| 255 | + needs: |
| 256 | + - meta |
| 257 | + - build_action |
| 258 | + container: |
| 259 | + image: python:3.9-buster |
| 260 | + services: |
| 261 | + splunk: |
| 262 | + image: splunk/splunk:${{ fromJson(needs.meta.outputs.matrix_supportedSplunk)[0].version }} |
| 263 | + ports: |
| 264 | + - 8088:8088 |
| 265 | + - 8089:8089 |
| 266 | + env: |
| 267 | + SPLUNK_HEC_TOKEN: 70b6ae71-76b3-4c38-9597-0c5b37ad9630 |
| 268 | + SPLUNK_PASSWORD: Changed@11 |
| 269 | + SPLUNK_START_ARGS: --accept-license |
| 270 | + SPLUNK_APPS_URL: https://github.com/splunk/splunk-configurations-base-indexes/releases/download/v1.0.0/splunk_configurations_base_indexes-1.0.0.tar.gz |
| 271 | + sc4s: |
| 272 | + image: ${{ needs.meta.outputs.container_base }} |
| 273 | + ports: |
| 274 | + - 514:514 |
| 275 | + env: |
| 276 | + SC4S_DEST_SPLUNK_HEC_DEFAULT_URL: https://splunk:8088 |
| 277 | + SC4S_DEST_SPLUNK_HEC_DEFAULT_TOKEN: 70b6ae71-76b3-4c38-9597-0c5b37ad9630 |
| 278 | + SC4S_DEST_SPLUNK_HEC_DEFAULT_TLS_VERIFY: "no" |
| 279 | + SC4S_USE_NAME_CACHE: "yes" |
| 280 | + SC4S_CLEAR_NAME_CACHE: "yes" |
| 281 | + steps: |
| 282 | + - name: Checkout |
| 283 | + uses: actions/checkout@v4 |
| 284 | + with: |
| 285 | + submodules: false |
| 286 | + persist-credentials: false |
| 287 | + - name: Run tests |
| 288 | + run: | |
| 289 | + pip3 install poetry |
| 290 | + poetry install |
| 291 | + mkdir -p test-results || true |
| 292 | + poetry run pytest -v --tb=long \ |
| 293 | + --splunk_type=external \ |
| 294 | + --splunk_hec_token=70b6ae71-76b3-4c38-9597-0c5b37ad9630 \ |
| 295 | + --splunk_host=splunk \ |
| 296 | + --sc4s_host=sc4s \ |
| 297 | + --junitxml=test-results/test.xml \ |
| 298 | + -n 1 \ |
| 299 | + -m 'name_cache' |
| 300 | + test-ipv6-name-cache: |
| 301 | + runs-on: ubuntu-latest |
| 302 | + needs: |
| 303 | + - meta |
| 304 | + - build_action |
| 305 | + container: |
| 306 | + image: python:3.9-buster |
| 307 | + services: |
| 308 | + splunk: |
| 309 | + image: splunk/splunk:${{ fromJson(needs.meta.outputs.matrix_supportedSplunk)[0].version }} |
| 310 | + ports: |
| 311 | + - 8088:8088 |
| 312 | + - 8089:8089 |
| 313 | + env: |
| 314 | + SPLUNK_HEC_TOKEN: 70b6ae71-76b3-4c38-9597-0c5b37ad9630 |
| 315 | + SPLUNK_PASSWORD: Changed@11 |
| 316 | + SPLUNK_START_ARGS: --accept-license |
| 317 | + SPLUNK_APPS_URL: https://github.com/splunk/splunk-configurations-base-indexes/releases/download/v1.0.0/splunk_configurations_base_indexes-1.0.0.tar.gz |
| 318 | + sc4s: |
| 319 | + image: ${{ needs.meta.outputs.container_base }} |
| 320 | + ports: |
| 321 | + - 514:514 |
| 322 | + env: |
| 323 | + SC4S_DEST_SPLUNK_HEC_DEFAULT_URL: https://splunk:8088 |
| 324 | + SC4S_DEST_SPLUNK_HEC_DEFAULT_TOKEN: 70b6ae71-76b3-4c38-9597-0c5b37ad9630 |
| 325 | + SC4S_DEST_SPLUNK_HEC_DEFAULT_TLS_VERIFY: "no" |
| 326 | + SC4S_USE_NAME_CACHE: "yes" |
| 327 | + SC4S_CLEAR_NAME_CACHE: "yes" |
| 328 | + SC4S_IPV6_ENABLE: "yes" |
| 329 | + steps: |
| 330 | + - name: Checkout |
| 331 | + uses: actions/checkout@v4 |
| 332 | + with: |
| 333 | + submodules: false |
| 334 | + persist-credentials: false |
| 335 | + - name: Run tests |
| 336 | + run: | |
| 337 | + pip3 install poetry |
| 338 | + poetry install |
| 339 | + mkdir -p test-results || true |
| 340 | + poetry run pytest -v --tb=long \ |
| 341 | + --splunk_type=external \ |
| 342 | + --splunk_hec_token=70b6ae71-76b3-4c38-9597-0c5b37ad9630 \ |
| 343 | + --splunk_host=splunk \ |
| 344 | + --sc4s_host=sc4s \ |
| 345 | + --junitxml=test-results/test.xml \ |
| 346 | + -n 1 \ |
| 347 | + -m 'name_cache' |
| 348 | + release: |
| 349 | + name: Release |
| 350 | + runs-on: ubuntu-latest |
| 351 | + needs: |
| 352 | + - meta |
| 353 | + - build_action |
| 354 | + - test-container |
| 355 | + - test-ipv4-name-cache |
| 356 | + steps: |
| 357 | + - uses: actions/checkout@v4 |
| 358 | + with: |
| 359 | + submodules: false |
| 360 | + persist-credentials: false |
| 361 | + - uses: actions/setup-node@v4 |
| 362 | + with: |
| 363 | + node-version: "16" |
| 364 | + - name: Semantic Release |
| 365 | + id: version |
| 366 | + uses: cycjimmy/semantic-release-action@v3 |
| 367 | + with: |
| 368 | + semantic_version: 18 |
| 369 | + extra_plugins: | |
| 370 | + @semantic-release/[email protected] |
| 371 | + @semantic-release/git |
| 372 | + semantic-release-helm |
| 373 | + |
| 374 | + |
| 375 | + env: |
| 376 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN_ADMIN }} |
| 377 | + |
0 commit comments