-
Notifications
You must be signed in to change notification settings - Fork 16
Build Pipelines for bitcoind, dogecoind and rippled image builds #75
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
Open
fl-matic-rupnik
wants to merge
3
commits into
flare-foundation:main
Choose a base branch
from
fl-matic-rupnik:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| name: Release bitcoind image | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| tags: ["*"] | ||
| paths: ["images/bitcoind/**"] | ||
| pull_request: | ||
| branches: [main] | ||
| paths: ["images/bitcoind/**"] | ||
|
|
||
| jobs: | ||
| call: | ||
| uses: ./.github/workflows/release-image.yml | ||
| with: | ||
| image: ghcr.io/${{ github.repository }}/bitcoind | ||
| context: images/bitcoind | ||
| dockerfile: Dockerfile | ||
| secrets: | ||
| registry-password: ${{ secrets.GITHUB_TOKEN }} |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| name: Release dogecoind image | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| tags: ["*"] | ||
| paths: ["images/dogecoind/**"] | ||
| pull_request: | ||
| branches: [main] | ||
| paths: ["images/dogecoind/**"] | ||
|
|
||
| jobs: | ||
| call: | ||
| uses: ./.github/workflows/release-image.yml | ||
| with: | ||
| image: ghcr.io/${{ github.repository }}/dogecoind | ||
| context: images/dogecoind | ||
| dockerfile: Dockerfile | ||
| secrets: | ||
| registry-password: ${{ secrets.GITHUB_TOKEN }} |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| image: | ||
| required: true | ||
| type: string | ||
| context: | ||
| required: true | ||
| type: string | ||
| dockerfile: | ||
| required: false | ||
| type: string | ||
| default: Dockerfile | ||
| secrets: | ||
| registry-password: | ||
| required: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| id-token: write | ||
| outputs: | ||
| digest: ${{ steps.build-and-push.outputs.digest }} | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Get image tag (from Dockerfile ARG VERSION) | ||
| id: get_image_tag | ||
| run: | | ||
| grep '^ARG VERSION=' "${{ inputs.context }}/$GITHUB_WORKFLOW" >/dev/null 2>&1 || true | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does this do? |
||
| RAW_VERSION=$(grep -m1 '^ARG VERSION=' "${{ inputs.context }}/${{ inputs.dockerfile }}" \ | ||
| | cut -d'=' -f2 | tr -d '"' | tr -d "'" | tr -d '[:space:]') | ||
| VERSION_FOR_TAG=${RAW_VERSION#v} | ||
| echo "image_tag=${VERSION_FOR_TAG}" >> $GITHUB_OUTPUT | ||
| echo "VERSION_FOR_GIT=${RAW_VERSION}" >> $GITHUB_ENV | ||
| echo "VERSION_FOR_TAG=${VERSION_FOR_TAG}" >> $GITHUB_ENV | ||
|
|
||
| - name: Install cosign | ||
| if: github.event_name != 'pull_request' | ||
| uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad | ||
| with: | ||
| cosign-release: "v2.5.3" | ||
|
|
||
| - name: Setup Buildx | ||
| uses: docker/setup-buildx-action@v2 | ||
|
|
||
| - name: Login to registry | ||
| if: github.event_name != 'pull_request' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DockerHub is missing |
||
| uses: docker/login-action@v2 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.registry-password }} | ||
|
|
||
| - name: Extract Docker metadata | ||
| id: meta | ||
| uses: docker/metadata-action@v4 | ||
| with: | ||
| images: ${{ inputs.image }} | ||
| tags: | | ||
| type=raw,value=${{ env.VERSION_FOR_TAG }} | ||
| type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | ||
| type=ref,event=tag,enable=${{ startsWith(github.ref, 'refs/tags/') }} | ||
|
|
||
| - name: Build and push | ||
| id: build-and-push | ||
| uses: docker/build-push-action@v4 | ||
| with: | ||
| context: ${{ inputs.context }} | ||
| file: ${{ inputs.context }}/${{ inputs.dockerfile }} | ||
| push: ${{ github.event_name != 'pull_request' }} | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Sign published image (keyless / certificate-based) | ||
| if: ${{ github.event_name != 'pull_request' }} | ||
| env: | ||
| COSIGN_EXPERIMENTAL: 1 | ||
| TAGS: ${{ steps.meta.outputs.tags }} | ||
| DIGEST: ${{ steps.build-and-push.outputs.digest }} | ||
| run: | | ||
| echo "${TAGS}" | xargs -n1 -I {} cosign sign --yes {}@${DIGEST} | ||
|
|
||
| - name: Verify signatures | ||
| if: ${{ github.event_name != 'pull_request' }} | ||
| env: | ||
| COSIGN_EXPERIMENTAL: 1 | ||
| TAGS: ${{ steps.meta.outputs.tags }} | ||
| DIGEST: ${{ steps.build-and-push.outputs.digest }} | ||
| run: | | ||
| echo "${TAGS}" | while read -r tag; do | ||
| cosign verify \ | ||
| --certificate-identity="https://github.com/${{ github.repository }}/.github/workflows/release-image.yml@${{ github.ref }}" \ | ||
| --certificate-oidc-issuer="https://token.actions.githubusercontent.com" \ | ||
| "${tag}@${DIGEST}" | ||
| done | ||
|
|
||
| # - name: Sign the published Docker image | ||
| # if: ${{ github.event_name != 'pull_request' }} | ||
| # env: | ||
| # TAGS: ${{ steps.meta.outputs.tags }} | ||
| # DIGEST: ${{ steps.build-and-push.outputs.digest }} | ||
| # run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} | ||
| # - name: Verify ghcr image signatures | ||
| # if: ${{ github.event_name != 'pull_request' }} | ||
| # shell: bash | ||
| # env: | ||
| # COSIGN_EXPERIMENTAL: 1 | ||
| # TAGS: ${{ steps.meta.outputs.tags }} | ||
| # DIGEST: ${{ steps.build-and-push.outputs.digest }} | ||
| # run: | | ||
| # echo "${TAGS}" | xargs -I {} cosign verify \ | ||
| # --certificate-identity=https://github.com/${{ github.repository }}/.github/workflows/release-dogecoind.yml@${{ github.ref }} \ | ||
| # --certificate-oidc-issuer=https://token.actions.githubusercontent.com \ | ||
| # "{}@${DIGEST}" | ||
| generate-provenance: | ||
| needs: [build] | ||
| if: ${{ github.event_name != 'pull_request' }} | ||
| permissions: | ||
| actions: read | ||
| id-token: write | ||
| packages: write | ||
| uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0 | ||
| with: | ||
| image: ${{ inputs.image }} | ||
| digest: ${{ needs.build.outputs.digest }} | ||
| registry-username: ${{ github.actor }} | ||
| secrets: | ||
| registry-password: ${{ secrets.registry-password }} | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| name: Release rippled image | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| tags: ["*"] | ||
| paths: ["images/rippled/**"] | ||
| pull_request: | ||
| branches: [main] | ||
| paths: ["images/rippled/**"] | ||
|
|
||
| jobs: | ||
| call: | ||
| uses: ./.github/workflows/release-image.yml | ||
| with: | ||
| image: ghcr.io/${{ github.repository }}/rippled | ||
| context: images/rippled | ||
| dockerfile: Dockerfile | ||
| secrets: | ||
| registry-password: ${{ secrets.GITHUB_TOKEN }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after this check if the image with the tag already exists to skip the unecessary work (xrpl takes ages to build, for example)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually caching works quite well here, contrary to kaniko