Skip to content

Commit

Permalink
refactor: deduplicate pinning
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Jul 28, 2021
1 parent 947f37d commit 5277083
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,6 @@ jobs:
- name: Read CID of updated DAG
id: cid-reader
run: echo "::set-output name=CID::$(tail -1 ./versions)"
- name: Pin new website to ipfs-websites.collab.ipfscluster.io for 7 days
run: |
echo 'pin to cluster'
ipfs-cluster-ctl --enc=json \
--host "/dnsaddr/ipfs-websites.collab.ipfscluster.io" \
--basic-auth '${{ secrets.CLUSTER_USER }}:${{ secrets.CLUSTER_PASSWORD }}' \
pin add \
--pin-name="https://github.com/ipfs/distributions/commits/${{ github.sha }}" \
--no-status --expire-in 168h \
"${{ steps.cid-reader.outputs.CID }}"
while true; do
ipfs-cluster-ctl --enc=json \
--host "/dnsaddr/ipfs-websites.collab.ipfscluster.io" \
--basic-auth '${{ secrets.CLUSTER_USER }}:${{ secrets.CLUSTER_PASSWORD }}' \
status "${{ steps.cid-reader.outputs.CID }}" | tee cluster-pin-status
if [[ $(jq '.peer_map[].status' cluster-pin-status | grep '"pinned"' | wc -l) -ge 2 ]]; then
echo "Got 2 pin confirmations, finishing the workflow"
echo "Pinned ${{ matrix.dist_name }} nightly to IPFS - https://dweb.link/ipfs/${{ steps.cid-reader.outputs.CID }}/${{ matrix.dist_name }}/"
break
else
echo "(sleeping for 15 seconds)"
sleep 15
fi
done
timeout-minutes: 60
- name: Pin new website to ipfs-websites.collab.ipfscluster.io
run: ./scripts/ci/pin-to-cluster.sh
env:
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/pin-to-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ipfs-cluster-ctl --enc=json \
--host "/dnsaddr/ipfs-websites.collab.ipfscluster.io" \
--basic-auth "${CLUSTER_USER}:${CLUSTER_PASSWORD}" \
pin add \
--pin-name="${PIN_NAME}" \
--name "${PIN_NAME}" \
--no-status $PIN_ADD_EXTRA_ARGS \
"$PIN_CID"
echo "::endgroup::"
Expand Down

0 comments on commit 5277083

Please sign in to comment.