Compare commits

...

4 Commits

Author SHA1 Message Date
cf080607a6 add cascade-release.sh to make releases
All checks were successful
Github Actions Demo / Explore-Gitea-Actions (push) Successful in 1m37s
2024-03-03 19:32:42 -06:00
4e69d12907 dockerfile with yq 2024-03-03 19:32:42 -06:00
3566d361d1 change to cascade builds 2024-03-03 19:32:42 -06:00
Hector Sanjuan
1eb9ede246 Release v1.0.8 2024-03-03 19:32:42 -06:00
9 changed files with 41 additions and 351 deletions

20
.github/workflows/build.yaml vendored Normal file
View File

@ -0,0 +1,20 @@
name: Github Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions (on Gitea) 🚀
on: [push]
jobs:
Explore-Gitea-Actions:
runs-on: metal-docker
steps:
- name: Check out repository code
uses: actions/checkout@v3
- run: |
ls -la
docker build --progress plain --iidfile iid.txt .
stringprefix() { [ ${#1} -le $2 ] && echo $1 && return 0 || stringprefix "${1%?}" $2 ; }
SHORTSHA="$(stringprefix "$GITHUB_SHA" 8)"
for TAG in "$SHORTSHA" "$GITHUB_REF_NAME";do
docker tag "`cat iid.txt`" "$DOCKER_REGISTRY/$GITHUB_REPOSITORY:$TAG"
docker push "$DOCKER_REGISTRY/$GITHUB_REPOSITORY:$TAG"
done

View File

@ -1,80 +0,0 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '20 2 * * 5'
env:
GO: 1.21.4
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

View File

@ -1,70 +0,0 @@
name: Publish Docker image
on:
workflow_dispatch:
push:
branches:
- 'master'
tags:
- 'v*'
env:
REGISTRY: ""
IMAGE_NAME: ipfs/ipfs-cluster
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
# registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get tags
id: tags
run: |
echo "value<<EOF" >> $GITHUB_OUTPUT
./docker/get-docker-tags.sh "$(date -u +%F)" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
shell: bash
- name: Build Docker image and publish to Docker Hub
uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
context: .
push: true
file: ./Dockerfile
tags: "${{ steps.tags.outputs.value }}"
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache to limit growth
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

View File

@ -1,26 +0,0 @@
name: Close and mark stale issue
on:
schedule:
- cron: '0 0 * * *'
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.'
close-issue-message: 'This issue was closed because it is missing author input.'
stale-issue-label: 'kind/stale'
any-of-labels: 'need/author-input'
exempt-issue-labels: 'need/triage,need/community-input,need/maintainer-input,need/maintainers-input,need/analysis'
days-before-issue-stale: 6
days-before-issue-close: 7
enable-statistics: true

View File

@ -1,170 +0,0 @@
name: Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master, dependency-upgrades ]
env:
GO: 1.21.4
jobs:
tests-all:
name: "All modules + Coverage"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO }}
- name: "Tests"
run: go test -v -timeout 15m -coverprofile=coverage.txt -covermode=atomic ./...
- name: "Coverage"
uses: codecov/codecov-action@v2
tests-raft:
name: "Using Raft"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO }}
- name: "Tests"
run: go test -v -timeout 15m -failfast -consensus raft .
tests-leveldb:
name: "Using LevelDB"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO }}
- name: "Tests"
run: go test -v -timeout 15m -failfast -datastore leveldb .
tests-badger3:
name: "Using Badger3"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO }}
- name: "Tests"
run: go test -v -timeout 15m -failfast -datastore badger3 .
tests-badger:
name: "Using Badger"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO }}
- name: "Tests"
run: go test -v -timeout 15m -failfast -datastore badger .
tests-check:
name: "Build, syntax and spelling checks"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO }}
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Install misspell
run: go install github.com/client9/misspell/cmd/misspell@latest
- name: Check
run: make check
- name: Build binaries
run: make build
docker:
name: "Docker build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Docker builds
run: make docker
docker-compose:
name: "Docker Compose"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Docker compose
run: make docker-compose
sharness:
name: Sharness
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO }}
- name: Apt-get update
run: sudo apt-get update
- name: Install jq and curl
run: sudo apt-get install -y jq curl
- name: Make install
run: make install
- name: Pull kubo
run: docker pull ipfs/kubo
- name: Sharness
run: make test_sharness

View File

@ -1,4 +1,4 @@
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.21-bullseye AS builder FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.21-alpine3.19 AS builder
MAINTAINER Hector Sanjuan <code@hector.link> MAINTAINER Hector Sanjuan <code@hector.link>
# This dockerfile builds and runs ipfs-cluster-service. # This dockerfile builds and runs ipfs-cluster-service.
@ -8,6 +8,8 @@ ENV GOPATH /go
ENV SRC_PATH $GOPATH/src/github.com/ipfs-cluster/ipfs-cluster ENV SRC_PATH $GOPATH/src/github.com/ipfs-cluster/ipfs-cluster
ENV GOPROXY https://proxy.golang.org ENV GOPROXY https://proxy.golang.org
RUN apk add --no-cache git alpine-sdk
COPY --chown=1000:users go.* $SRC_PATH/ COPY --chown=1000:users go.* $SRC_PATH/
WORKDIR $SRC_PATH WORKDIR $SRC_PATH
RUN go mod download -x RUN go mod download -x
@ -20,7 +22,7 @@ RUN make install
#------------------------------------------------------ #------------------------------------------------------
FROM alpine:3.18 FROM alpine:3.19
MAINTAINER Hector Sanjuan <hector@protocol.ai> MAINTAINER Hector Sanjuan <hector@protocol.ai>
LABEL org.opencontainers.image.source=https://github.com/ipfs-cluster/ipfs-cluster LABEL org.opencontainers.image.source=https://github.com/ipfs-cluster/ipfs-cluster
@ -28,7 +30,7 @@ LABEL org.opencontainers.image.description="Pinset orchestration for IPFS"
LABEL org.opencontainers.image.licenses=MIT+APACHE_2.0 LABEL org.opencontainers.image.licenses=MIT+APACHE_2.0
# Install binaries for $TARGETARCH # Install binaries for $TARGETARCH
RUN apk add --no-cache tini su-exec ca-certificates RUN apk add --no-cache tini su-exec ca-certificates curl yq
ENV GOPATH /go ENV GOPATH /go
ENV SRC_PATH /go/src/github.com/ipfs-cluster/ipfs-cluster ENV SRC_PATH /go/src/github.com/ipfs-cluster/ipfs-cluster

14
cascade-release.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
set -e
if [ x"$(git branch --show)" != x"cascade" ];then
echo "this cannot be run on any branches other than cascade"
exit 1
fi
git fetch upstream
git checkout -b cascade-"$1"
git rebase "$1" || (git checkout cascade && git branch -D cascade-"$1";exit 1)
git push -u origin cascade-"$1"
git checkout cascade

View File

@ -27,7 +27,7 @@ const programName = `ipfs-cluster-ctl`
// Version is the cluster-ctl tool version. It should match // Version is the cluster-ctl tool version. It should match
// the IPFS cluster's version // the IPFS cluster's version
const Version = "1.0.7" const Version = "1.0.8"
var ( var (
defaultHost = "/ip4/127.0.0.1/tcp/9094" defaultHost = "/ip4/127.0.0.1/tcp/9094"

View File

@ -7,7 +7,7 @@ import (
) )
// Version is the current cluster version. // Version is the current cluster version.
var Version = semver.MustParse("1.0.7") var Version = semver.MustParse("1.0.8")
// RPCProtocol is protocol handler used to send libp2p-rpc messages between // RPCProtocol is protocol handler used to send libp2p-rpc messages between
// cluster peers. All peers in the cluster need to speak the same protocol // cluster peers. All peers in the cluster need to speak the same protocol