Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 2s
Server CI Nightly Race / Build Environment (push) Failing after 1s
116 lines
5.3 KiB
YAML
116 lines
5.3 KiB
YAML
name: Setup build environment
|
|
description: >
|
|
Builds the mattermost-build-server images if they don't yet exist on Docker
|
|
Hub (e.g. during a Go or Node version bump), and uploads them as artifacts
|
|
for downstream jobs. Run once per workflow before any build or test jobs.
|
|
|
|
inputs:
|
|
build-server-tag:
|
|
description: "Build image tag, from server/build/buildenv-tag.sh (e.g. go1.26.3-node24.11.1)"
|
|
required: true
|
|
dockerfile:
|
|
description: "Path to Dockerfile.buildenv (relative to workspace root)"
|
|
required: false
|
|
default: "server/build/Dockerfile.buildenv"
|
|
dockerfile-fips:
|
|
description: "Path to Dockerfile.buildenv-fips (relative to workspace root)"
|
|
required: false
|
|
default: "server/build/Dockerfile.buildenv-fips"
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Set constants
|
|
id: constants
|
|
shell: bash
|
|
run: |
|
|
{
|
|
echo "image=mattermost/mattermost-build-server"
|
|
echo "artifact=buildenv-image"
|
|
echo "fips-image=mattermost/mattermost-build-server-fips"
|
|
echo "fips-artifact=buildenv-fips-image"
|
|
echo "tmpdir=/tmp/buildenv-save"
|
|
} >> "${GITHUB_OUTPUT}"
|
|
# ── Regular ────────────────────────────────────────────────────────
|
|
- name: Resolve regular image
|
|
id: resolve
|
|
shell: bash
|
|
env:
|
|
BUILDENV_IMAGE: ${{ steps.constants.outputs.image }}
|
|
BUILDENV_TAG: ${{ inputs.build-server-tag }}
|
|
run: |
|
|
docker manifest inspect "${BUILDENV_IMAGE}:${BUILDENV_TAG}" > /dev/null 2>&1 || \
|
|
echo "needs-build=true" >> "${GITHUB_OUTPUT}"
|
|
- name: Build regular image
|
|
if: ${{ steps.resolve.outputs.needs-build == 'true' }}
|
|
shell: bash
|
|
env:
|
|
BUILDENV_IMAGE: ${{ steps.constants.outputs.image }}
|
|
BUILDENV_TAG: ${{ inputs.build-server-tag }}
|
|
BUILDENV_DOCKERFILE: ${{ inputs.dockerfile }}
|
|
run: docker build -t "${BUILDENV_IMAGE}:${BUILDENV_TAG}" - < "${BUILDENV_DOCKERFILE}"
|
|
- name: Save and upload regular image
|
|
if: ${{ steps.resolve.outputs.needs-build == 'true' }}
|
|
shell: bash
|
|
env:
|
|
BUILDENV_IMAGE: ${{ steps.constants.outputs.image }}
|
|
BUILDENV_TAG: ${{ inputs.build-server-tag }}
|
|
BUILDENV_TMPDIR: ${{ steps.constants.outputs.tmpdir }}
|
|
run: |
|
|
mkdir -p "${BUILDENV_TMPDIR}"
|
|
docker save "${BUILDENV_IMAGE}:${BUILDENV_TAG}" | gzip > "${BUILDENV_TMPDIR}/image.tar.gz"
|
|
- name: Upload regular image artifact
|
|
if: ${{ steps.resolve.outputs.needs-build == 'true' }}
|
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
|
with:
|
|
name: ${{ steps.constants.outputs.artifact }}
|
|
path: ${{ steps.constants.outputs.tmpdir }}/image.tar.gz
|
|
retention-days: 1
|
|
# ── FIPS (skipped on fork PRs) ─────────────────────────────────────
|
|
- name: Docker Hub login
|
|
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
|
|
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
|
|
with:
|
|
username: ${{ env.DOCKERHUB_USERNAME }}
|
|
password: ${{ env.DOCKERHUB_TOKEN }}
|
|
- name: Setup Chainctl
|
|
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
|
|
uses: chainguard-dev/setup-chainctl@c125f765e82b09a42af3185f3214465314d75c5d # v0.5.0
|
|
with:
|
|
identity: ${{ env.CHAINCTL_IDENTITY }}
|
|
- name: Resolve FIPS image
|
|
id: resolve-fips
|
|
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
|
|
shell: bash
|
|
env:
|
|
BUILDENV_FIPS_IMAGE: ${{ steps.constants.outputs.fips-image }}
|
|
BUILDENV_TAG: ${{ inputs.build-server-tag }}
|
|
run: |
|
|
docker manifest inspect "${BUILDENV_FIPS_IMAGE}:${BUILDENV_TAG}" > /dev/null 2>&1 || \
|
|
echo "needs-build=true" >> "${GITHUB_OUTPUT}"
|
|
- name: Build FIPS image
|
|
if: ${{ steps.resolve-fips.outputs.needs-build == 'true' }}
|
|
shell: bash
|
|
env:
|
|
BUILDENV_FIPS_IMAGE: ${{ steps.constants.outputs.fips-image }}
|
|
BUILDENV_TAG: ${{ inputs.build-server-tag }}
|
|
BUILDENV_FIPS_DOCKERFILE: ${{ inputs.dockerfile-fips }}
|
|
run: docker build -t "${BUILDENV_FIPS_IMAGE}:${BUILDENV_TAG}" - < "${BUILDENV_FIPS_DOCKERFILE}"
|
|
- name: Save and upload FIPS image
|
|
if: ${{ steps.resolve-fips.outputs.needs-build == 'true' }}
|
|
shell: bash
|
|
env:
|
|
BUILDENV_FIPS_IMAGE: ${{ steps.constants.outputs.fips-image }}
|
|
BUILDENV_TAG: ${{ inputs.build-server-tag }}
|
|
BUILDENV_TMPDIR: ${{ steps.constants.outputs.tmpdir }}
|
|
run: |
|
|
mkdir -p "${BUILDENV_TMPDIR}"
|
|
docker save "${BUILDENV_FIPS_IMAGE}:${BUILDENV_TAG}" | gzip > "${BUILDENV_TMPDIR}/image-fips.tar.gz"
|
|
- name: Upload FIPS image artifact
|
|
if: ${{ steps.resolve-fips.outputs.needs-build == 'true' }}
|
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
|
with:
|
|
name: ${{ steps.constants.outputs.fips-artifact }}
|
|
path: ${{ steps.constants.outputs.tmpdir }}/image-fips.tar.gz
|
|
retention-days: 1
|