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

github: For PRs, build docker image with the PR's branch of Rosetta #273

Merged
merged 2 commits into from
Feb 3, 2022
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .changelog/273.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: For PRs, build docker image with the PR's branch of Rosetta Gateway
1 change: 1 addition & 0 deletions .github/workflows/ci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
# NOTE: The version must be specified without the patch version.
version: v1.39
skip-go-installation: true
args: --timeout 2m
# Always run this step so that all linting errors can be seen at once.
if: always()
- name: Ensure a clean code checkout
Expand Down
23 changes: 14 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,37 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Determine tag name
id: determine_tag
- name: Determine branch and tag name
id: branch_tag
shell: bash
run: |
if [[ -z $GITHUB_BASE_REF ]]; then
# On master/stable branches.
branch=${GITHUB_REF#refs/heads/}
branch=${GITHUB_REF_NAME}
tag=${GITHUB_REF_NAME}
else
# On pull request branches.
branch=pr-$(git describe --always --match '' --abbrev=7)
branch=${GITHUB_HEAD_REF}
tag=pr-$(git describe --always --match '' --abbrev=7)
fi
branch=${branch//\//-}
echo "::set-output name=tag::${branch}"
tag=${tag//\//-}
echo "::set-output name=branch::${branch}"
echo "::set-output name=tag::${tag}"
echo "::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: "Rebuild oasisprotocol/oasis-core-rosetta-gateway:${{ steps.determine_tag.outputs.tag }}"
- name: "Rebuild oasisprotocol/oasis-core-rosetta-gateway:${{ steps.branch_tag.outputs.tag }}"
uses: docker/build-push-action@v2.6.1
with:
context: docker
file: docker/Dockerfile
tags: oasisprotocol/oasis-core-rosetta-gateway:${{ steps.determine_tag.outputs.tag }}
build-args: |
GATEWAY_BRANCH=${{ steps.branch_tag.outputs.branch }}
tags: oasisprotocol/oasis-core-rosetta-gateway:${{ steps.branch_tag.outputs.tag }}
pull: true
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.created=${{ steps.determine_tag.outputs.created }}
org.opencontainers.image.created=${{ steps.branch_tag.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}