Skip to content

[fix] environment is not correct #3

[fix] environment is not correct

[fix] environment is not correct #3

Workflow file for this run

name: Package vngcloud-csi-volume-modifier into container image on MAIN branch
on:
push:
tags:
- 'v*'
pull_request:
tags:
- 'v*'
jobs:
package-image:
runs-on: ubuntu-latest
environment:
name: production # Set the environment name
if: contains(github.event.head_commit.message, '[build]')
steps:
- name: Send alert that a new commit has been created
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
🚀 *[PROD] NEW COMMIT*
*Repository*: `${{ github.repository }}`
*Author*: `${{ github.actor }}`
*Action*: Building `vngcloud-csi-volume-modifier` image
*Commit message*:
```
${{ github.event.commits[0].message }}
```
*See changes*: https://github.com/${{ github.repository }}/commit/${{github.sha}}
*See workflow*: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- uses: actions/checkout@v4
- name: Login to VngCloud Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.VCR_REGISTRY }}
username: ${{ secrets.VCR_USERNAME }}
password: ${{ secrets.VCR_PASSWORD }}
- name: Build vngcloud-csi-volume-modifier image
continue-on-error: true
run: |
export REGISTRY=${{ secrets.VCR_REGISTRY }}
export VERSION=${{ github.ref_name }}
make docker-build
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Send alert that the image has been built failed
uses: appleboy/telegram-action@master
if: ${{ failure() }}
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
⛔ *[PROD] ERROR*
*Repository*: `${{ github.repository }}`
*Author*: `${{ github.actor }}`
*Action*: Failed to build `vngcloud-csi-volume-modifier` image
*Commit message*:
```
${{ github.event.commits[0].message }}
```
*See changes*: https://github.com/${{ github.repository }}/commit/${{github.sha}}
*See workflow*: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Send alert that the image has been built success
uses: appleboy/telegram-action@master
if: ${{ success() }}
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
📦 *[PROD] SUCCESS*
*Repository*: `${{ github.repository }}`
*Author*: `${{ github.actor }}`
*Action*: The `vngcloud-csi-volume-modifier:${{ env.VERSION }}` image is built successfully, try to push it to VngCloud Registry
*Commit message*:
```
${{ github.event.commits[0].message }}
```
*See changes*: https://github.com/${{ github.repository }}/commit/${{github.sha}}
*See workflow*: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Push vngcloud-csi-volume-modifier image
continue-on-error: true
run: |
export REGISTRY=${{ secrets.VCR_REGISTRY }}
export VERSION=$VERSION
make docker-push
- name: Send alert that the image has been pushed failed
uses: appleboy/telegram-action@master
if: ${{ failure() }}
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
⛔ *[PROD] ERROR*
*Repository*: `${{ github.repository }}`
*Author*: `${{ github.actor }}`
*Action*: Failed to PUSH `vngcloud-csi-volume-modifier` image to VngCloud registry
*Commit message*:
```
${{ github.event.commits[0].message }}
```
*See changes*: https://github.com/${{ github.repository }}/commit/${{github.sha}}
*See workflow*: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Send alert that the image has been pushed success
uses: appleboy/telegram-action@master
if: ${{ success() }}
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
🛸 *[PROD] SUCCESS*
*Repository*: `${{ github.repository }}`
*Author*: `${{ github.actor }}`
*Action*: The `vngcloud-csi-volume-modifier:${{ env.VERSION }}` image is pushed successfully to VngCloud registry
*Commit message*:
```
${{ github.event.commits[0].message }}
```
*See changes*: https://github.com/${{ github.repository }}/commit/${{github.sha}}
*See workflow*: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}