[CLD-6501] Enhance visibility for PR builds artefacts (#25141)
Co-authored-by: Akis Maziotis <akis.maziotis@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
76234892d2
Коммит
f01e8f6c6d
82
.github/workflows/artifacts.yml
поставляемый
82
.github/workflows/artifacts.yml
поставляемый
@@ -1,82 +0,0 @@
|
|||||||
name: Artifacts generation and upload
|
|
||||||
on:
|
|
||||||
workflow_run:
|
|
||||||
workflows: ["Server CI Master", "Server CI PR"]
|
|
||||||
types:
|
|
||||||
- completed
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
upload-s3:
|
|
||||||
name: cd/Upload artifacts to S3
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
if: github.repository_owner == 'mattermost' && github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
|
|
||||||
steps:
|
|
||||||
- name: cd/Configure AWS
|
|
||||||
uses: aws-actions/configure-aws-credentials@07c2f971bac433df982ccc261983ae443861db49 # v1-node16
|
|
||||||
with:
|
|
||||||
aws-region: us-east-1
|
|
||||||
aws-access-key-id: ${{ secrets.PR_BUILDS_BUCKET_AWS_ACCESS_KEY_ID }}
|
|
||||||
aws-secret-access-key: ${{ secrets.PR_BUILDS_BUCKET_AWS_SECRET_ACCESS_KEY }}
|
|
||||||
- name: cd/Download artifacts
|
|
||||||
uses: dawidd6/action-download-artifact@0c49384d39ceb023b8040f480a25596fd6cf441b # v2.26.0
|
|
||||||
with:
|
|
||||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
|
||||||
run_id: ${{ github.event.workflow_run.id }}
|
|
||||||
workflow_conclusion: success
|
|
||||||
name: server-dist-artifact
|
|
||||||
path: server/dist
|
|
||||||
- name: cd/Upload artifacts to S3
|
|
||||||
env:
|
|
||||||
REPO_NAME: ${{ github.event.repository.name }}
|
|
||||||
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
|
|
||||||
run: |
|
|
||||||
aws s3 cp server/dist/ s3://pr-builds.mattermost.com/$REPO_NAME/commit/$COMMIT_SHA/ --acl public-read --cache-control "no-cache" --recursive --no-progress
|
|
||||||
|
|
||||||
build-docker:
|
|
||||||
name: cd/Build and push docker image
|
|
||||||
needs: upload-s3
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
if: github.repository_owner == 'mattermost' && github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
|
|
||||||
steps:
|
|
||||||
- name: cd/Login to Docker Hub
|
|
||||||
uses: docker/login-action@3da7dc6e2b31f99ef2cb9fb4c50fb0971e0d0139 # v2.1.0
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_DEV_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_DEV_TOKEN }}
|
|
||||||
- name: cd/Download artifacts
|
|
||||||
uses: dawidd6/action-download-artifact@0c49384d39ceb023b8040f480a25596fd6cf441b # v2.26.0
|
|
||||||
with:
|
|
||||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
|
||||||
run_id: ${{ github.event.workflow_run.id }}
|
|
||||||
workflow_conclusion: success
|
|
||||||
name: server-build-artifact
|
|
||||||
path: server/build/
|
|
||||||
- name: cd/Setup Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@11e8a2e2910826a92412015c515187a2d6750279 # v2.4
|
|
||||||
- name: cd/Docker build and push
|
|
||||||
env:
|
|
||||||
DOCKER_CLI_EXPERIMENTAL: enabled
|
|
||||||
REPO_NAME: ${{ github.event.repository.name }}
|
|
||||||
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
|
|
||||||
run: |
|
|
||||||
export TAG=$(echo "${{ github.event.pull_request.head.sha || github.event.workflow_run.head_sha }}" | cut -c1-7)
|
|
||||||
cd server/build
|
|
||||||
export DOCKER_CLI_EXPERIMENTAL=enabled
|
|
||||||
export MM_PACKAGE=https://pr-builds.mattermost.com/$REPO_NAME/commit/$COMMIT_SHA/mattermost-team-linux-amd64.tar.gz
|
|
||||||
docker buildx build --push --build-arg MM_PACKAGE=$MM_PACKAGE -t mattermostdevelopment/mm-te-test:${TAG} .
|
|
||||||
|
|
||||||
sentry:
|
|
||||||
name: Send build info to sentry
|
|
||||||
if: >
|
|
||||||
github.event.workflow_run.event == 'push'
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
env:
|
|
||||||
SENTRY_AUTH_TOKEN: ${{ secrets.MM_SERVER_SENTRY_AUTH_TOKEN }}
|
|
||||||
SENTRY_ORG: ${{ secrets.MM_SERVER_SENTRY_ORG }}
|
|
||||||
SENTRY_PROJECT: ${{ secrets.MM_SERVER_SENTRY_PROJECT }}
|
|
||||||
steps:
|
|
||||||
- name: cd/Checkout mattermost project
|
|
||||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
|
||||||
- name: cd/Create Sentry release
|
|
||||||
uses: getsentry/action-release@85e0095193a153d57c458995f99d0afd81b9e5ea # v1.3.0
|
|
||||||
|
|
||||||
24
.github/workflows/sentry.yaml
поставляемый
Обычный файл
24
.github/workflows/sentry.yaml
поставляемый
Обычный файл
@@ -0,0 +1,24 @@
|
|||||||
|
## Upload sentry results when Server CI Master is completed
|
||||||
|
name: Sentry Upload
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows:
|
||||||
|
- "Server CI Master"
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sentry:
|
||||||
|
name: Send build info to sentry
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
env:
|
||||||
|
SENTRY_AUTH_TOKEN: ${{ secrets.MM_SERVER_SENTRY_AUTH_TOKEN }}
|
||||||
|
SENTRY_ORG: ${{ secrets.MM_SERVER_SENTRY_ORG }}
|
||||||
|
SENTRY_PROJECT: ${{ secrets.MM_SERVER_SENTRY_PROJECT }}
|
||||||
|
steps:
|
||||||
|
- name: cd/Checkout mattermost project
|
||||||
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||||
|
- name: cd/Create Sentry release
|
||||||
|
uses: getsentry/action-release@85e0095193a153d57c458995f99d0afd81b9e5ea # v1.3.0
|
||||||
|
|
||||||
131
.github/workflows/server-ci-artifacts.yml
поставляемый
Обычный файл
131
.github/workflows/server-ci-artifacts.yml
поставляемый
Обычный файл
@@ -0,0 +1,131 @@
|
|||||||
|
name: Server CI Artifacts
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows:
|
||||||
|
- "Server CI PR"
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
## We only need the condition on the first job
|
||||||
|
## This will run only when a pull request is created with server changes
|
||||||
|
update-initial-status:
|
||||||
|
if: github.repository_owner == 'mattermost' && github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- uses: mattermost/actions/delivery/update-commit-status@a74f6d87f847326c04d326bf1908da40cb9b3556
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
with:
|
||||||
|
repository_full_name: ${{ github.repository }}
|
||||||
|
commit_sha: ${{ github.event.workflow_run.head_sha }}
|
||||||
|
context: Server CI/Artifacts Build
|
||||||
|
description: Artifacts upload and build for mattermost team platform
|
||||||
|
status: pending
|
||||||
|
|
||||||
|
upload-artifacts:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
needs:
|
||||||
|
- update-initial-status
|
||||||
|
steps:
|
||||||
|
- name: cd/configure-aws-credentials
|
||||||
|
uses: aws-actions/configure-aws-credentials@04b98b3f9e85f563fb061be8751a0352327246b0 #v3.0.1
|
||||||
|
with:
|
||||||
|
aws-region: us-east-1
|
||||||
|
aws-access-key-id: ${{ secrets.PR_BUILDS_BUCKET_AWS_ACCESS_KEY_ID }}
|
||||||
|
aws-secret-access-key: ${{ secrets.PR_BUILDS_BUCKET_AWS_SECRET_ACCESS_KEY }}
|
||||||
|
|
||||||
|
- name: cd/download-artifacts-from-PR-workflow
|
||||||
|
uses: dawidd6/action-download-artifact@0c49384d39ceb023b8040f480a25596fd6cf441b # v2.26.0
|
||||||
|
with:
|
||||||
|
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||||
|
run_id: ${{ github.event.workflow_run.id }}
|
||||||
|
workflow_conclusion: success
|
||||||
|
name: server-dist-artifact
|
||||||
|
path: server/dist
|
||||||
|
|
||||||
|
- name: cd/generate-packages-file-list
|
||||||
|
working-directory: ./server/dist
|
||||||
|
run: |
|
||||||
|
echo "PACKAGES_FILE_LIST<<EOF" >> "${GITHUB_ENV}"
|
||||||
|
ls | grep -E "*.(tar.gz|zip)$" >> "${GITHUB_ENV}"
|
||||||
|
echo "EOF" >> "${GITHUB_ENV}"
|
||||||
|
|
||||||
|
- name: cd/upload-artifacts-to-s3
|
||||||
|
run: aws s3 sync server/dist/ s3://pr-builds.mattermost.com/mattermost/commit/${{ github.event.workflow_run.head_sha }}/ --cache-control no-cache --no-progress --acl public-read
|
||||||
|
|
||||||
|
- name: cd/generate-summary
|
||||||
|
run: |
|
||||||
|
echo "### Download links for Mattermost team package" >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
echo " " >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
echo "Mattermost Repo SHA: \`${{ github.event.workflow_run.head_sha }}\`" >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
echo "|Download Link|" >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
echo "| --- |" >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
for package in ${PACKAGES_FILE_LIST}
|
||||||
|
do
|
||||||
|
echo "|[${package}](https://s3.amazonaws.com/pr-builds.mattermost.com/mattermost/commit/${{ github.event.workflow_run.head_sha }}/${package})|" >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
done
|
||||||
|
|
||||||
|
build-docker:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
needs:
|
||||||
|
- upload-artifacts
|
||||||
|
steps:
|
||||||
|
- name: cd/docker-login
|
||||||
|
uses: docker/login-action@3da7dc6e2b31f99ef2cb9fb4c50fb0971e0d0139 # v2.1.0
|
||||||
|
with:
|
||||||
|
username: mattermostdev
|
||||||
|
password: ${{ secrets.DOCKERHUB_DEV_TOKEN }}
|
||||||
|
|
||||||
|
- name: cd/download-artifacts-from-PR-workflow
|
||||||
|
uses: dawidd6/action-download-artifact@0c49384d39ceb023b8040f480a25596fd6cf441b # v2.26.0
|
||||||
|
with:
|
||||||
|
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||||
|
run_id: ${{ github.event.workflow_run.id }}
|
||||||
|
workflow_conclusion: success
|
||||||
|
name: server-build-artifact
|
||||||
|
path: server/build/
|
||||||
|
|
||||||
|
- name: cd/setup-docker-buildx
|
||||||
|
uses: docker/setup-buildx-action@11e8a2e2910826a92412015c515187a2d6750279 # v2.4
|
||||||
|
|
||||||
|
- name: cd/docker-build-and-push
|
||||||
|
env:
|
||||||
|
MM_PACKAGE: https://pr-builds.mattermost.com/mattermost/commit/${{ github.event.workflow_run.head_sha }}/mattermost-team-linux-amd64.tar.gz
|
||||||
|
run: |
|
||||||
|
export TAG=$(echo "${{ github.event.workflow_run.head_sha }}" | cut -c1-7)
|
||||||
|
cd server/build
|
||||||
|
docker buildx build --no-cache --platform linux/amd64 --push --build-arg MM_PACKAGE=$MM_PACKAGE -t mattermostdevelopment/mm-te-test:${TAG} .
|
||||||
|
|
||||||
|
update-failure-final-status:
|
||||||
|
if: failure() || cancelled()
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
needs:
|
||||||
|
- build-docker
|
||||||
|
steps:
|
||||||
|
- uses: mattermost/actions/delivery/update-commit-status@a74f6d87f847326c04d326bf1908da40cb9b3556
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
with:
|
||||||
|
repository_full_name: ${{ github.repository }}
|
||||||
|
commit_sha: ${{ github.event.workflow_run.head_sha }}
|
||||||
|
context: Server CI/Artifacts Build
|
||||||
|
description: Artifacts upload and build for mattermost team platform
|
||||||
|
status: failure
|
||||||
|
|
||||||
|
update-success-final-status:
|
||||||
|
if: success()
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
needs:
|
||||||
|
- build-docker
|
||||||
|
steps:
|
||||||
|
- uses: mattermost/actions/delivery/update-commit-status@a74f6d87f847326c04d326bf1908da40cb9b3556
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
with:
|
||||||
|
repository_full_name: ${{ github.repository }}
|
||||||
|
commit_sha: ${{ github.event.workflow_run.head_sha }}
|
||||||
|
context: Server CI/Artifacts Build
|
||||||
|
description: Artifacts upload and build for mattermost team platform
|
||||||
|
status: success
|
||||||
@@ -39,7 +39,7 @@ HEALTHCHECK --interval=30s --timeout=10s \
|
|||||||
CMD curl -f http://localhost:8065/api/v4/system/ping || exit 1
|
CMD curl -f http://localhost:8065/api/v4/system/ping || exit 1
|
||||||
|
|
||||||
# Configure entrypoint and command
|
# Configure entrypoint and command
|
||||||
COPY entrypoint.sh /
|
COPY --chown=mattermost:mattermost --chmod=765 entrypoint.sh /
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
WORKDIR /mattermost
|
WORKDIR /mattermost
|
||||||
CMD ["mattermost"]
|
CMD ["mattermost"]
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user