Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pr action rollback last commit #2106

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 5 additions & 51 deletions .github/workflows/pr-ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
jobs:
rainbond:
runs-on: ubuntu-latest
environment: pr
strategy:
matrix:
component: [api, chaos, worker, init-probe, mq]
Expand All @@ -18,16 +17,11 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Aliyun Container Registry
uses: docker/login-action@v3
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.DOMESTIC_DOCKER_USERNAME }}
password: ${{ secrets.DOMESTIC_DOCKER_PASSWORD }}

- name: Set release description
run: |
release_desc="pr-${{ github.event.pull_request.number }}"
buildTime=$(date +%F-%H)
git_commit=$(git log -n 1 --pretty --format=%h)
release_desc="dev-${git_commit}-${buildTime}"
echo "release_desc=$release_desc" >> $GITHUB_ENV
- name: Build and push
Expand All @@ -38,46 +32,6 @@ jobs:
RELEASE_DESC=${{ env.release_desc }}
context: .
file: hack/contrib/docker/${{ matrix.component }}/Dockerfile
push: true
push: false
tags: |
registry.cn-hangzhou.aliyuncs.com/goodrain/rbd-${{ matrix.component }}:${{ env.release_desc }}
- name: Save image info to file
run: |
IMAGE_TAG="registry.cn-hangzhou.aliyuncs.com/goodrain/rbd-${{ matrix.component }}:${{ env.release_desc }}"
echo "- ${IMAGE_TAG}" >> image_tags.txt
- name: Upload image info to be used in final step
uses: actions/upload-artifact@v3
with:
name: image-tags
path: image_tags.txt

comment:
runs-on: ubuntu-latest
environment: pr
needs: rainbond
steps:
- name: Download image tags
uses: actions/download-artifact@v3
with:
name: image-tags

- name: Set PR number
run: echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV

- name: Generate comment content
run: |
IMAGE_TAGS=$(cat image_tags.txt)
COMMENT="### Preview Docker Images\n$IMAGE_TAGS"
echo "COMMENT_CONTENT=$COMMENT" >> $GITHUB_ENV
- name: Comment PR with Docker Image IDs
run: |
PR_NUMBER=${{ env.PR_NUMBER }}
COMMENT_CONTENT="${{ env.COMMENT_CONTENT }}"
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d "{\"body\": \"$COMMENT_CONTENT\"}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
rainbond/rbd-${{ matrix.component }}:dev
Loading