Gateway listing only 1000 first object of prefix/dir #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Dev Preview Image | |
on: | |
# github treats issue comments and PR comments as the same. | |
# Further down there's a bit that restricts the job itself to a PR | |
# comment with a specific body. Credit to https://grem1.in/post/gha-comment-trigger/ for this script | |
issue_comment: | |
types: | |
- created | |
jobs: | |
build-and-push-dev-container: | |
runs-on: ubuntu-22.04 | |
name: Builds and pushes the docker image for the open source NGINX version to github packages | |
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/build_dev' }} | |
steps: | |
- name: Put a reaction to the comment | |
run: gh api graphql --silent --raw-field query="mutation AddReaction {addReaction(input:{subjectId:\"$NODE_ID\",content:EYES}){reaction{content}subject{id}}}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_ID: ${{ github.event.comment.node_id }} | |
- name: Check if PR is open | |
run: | | |
STATE=$(gh pr view $PR_NUMBER --repo ${{ github.repository }} --json state --jq .state) | |
if [ "$STATE" != "OPEN" ]; then | |
echo "Cannot build for closed PRs" | |
( | |
echo "**${{ github.workflow }}**" | |
echo "Cannot build Kuby for a closed PR. Use the `latest` version (built for the `master` branch) or create a new PR." | |
) | \ | |
gh pr comment "${PR_NUMBER}" --repo ${{ github.repository }} -F - | |
gh api graphql --silent --raw-field query="mutation AddReaction {addReaction(input:{subjectId:\"$NODE_ID\",content:THUMBS_DOWN}){reaction{content}subject{id}}}" | |
gh api graphql --silent --raw-field query="mutation RemoveReaction {removeReaction(input:{subjectId:\"$NODE_ID\",content:EYES}){reaction{content}subject{id}}}" | |
exit 1 | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PR_NUMBER: ${{ github.event.issue.number }} | |
NODE_ID: ${{ github.event.comment.node_id }} | |
- name: Get PR HEAD Ref | |
id: getRef | |
run: echo "pr_ref=$(gh pr view $PR_NUMBER --repo ${{ github.repository }} --json headRefOid | jq -r '.headRefOid')" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PR_NUMBER: ${{ github.event.issue.number }} | |
- name: Debug print out ref info | |
run: echo $(gh pr view $PR_NUMBER --repo ${{ github.repository }}) | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout source code from Github | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ steps.getRef.outputs.pr_ref }} | |
- name: Get Branch Name | |
id: getBranchName | |
run: echo "branch_name=$(gh pr view $PR_NUMBER --repo ${{ github.repository }} --json headRefName | jq -r '.headRefName')" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PR_NUMBER: ${{ github.event.issue.number }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Docker build setup | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push image [oss] | |
uses: docker/build-push-action@v5 | |
with: | |
file: Dockerfile.oss | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
provenance: false | |
tags: | | |
ghcr.io/${{ github.repository }}/nginx-oss-s3-gateway-dev:${{ steps.getBranchName.outputs.branch_name }} | |
- name: Final Comment | |
run: | | |
gh api graphql --silent --raw-field query="mutation AddReaction {addReaction(input:{subjectId:\"$NODE_ID\",content:THUMBS_UP}){reaction{content}subject{id}}}" | |
gh api graphql --silent --raw-field query="mutation RemoveReaction {removeReaction(input:{subjectId:\"$NODE_ID\",content:EYES}){reaction{content}subject{id}}}" | |
( | |
echo "**${{ github.workflow }}**" | |
echo "The long task is done!" | |
echo | |
echo "You can find the workflow here:" | |
echo "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
) | \ | |
gh pr comment "${PR_NUMBER}" --repo ${{ github.repository }} -F - | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PR_NUMBER: ${{ github.event.issue.number }} | |
NODE_ID: ${{ github.event.comment.node_id }} | |