diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 11fcef7..4aa051f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,7 +9,6 @@ jobs: balena_cloud_build: runs-on: ubuntu-latest strategy: - fail-fast: true matrix: arch: [aarch64, amd64, armv7hf] diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index aed50df..4f6c95c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,44 +11,9 @@ on: default: "" jobs: - ghr: - runs-on: ubuntu-latest - if: github.event_name == 'push' - - steps: - - name: checkout - uses: actions/checkout@v2 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v1 - - - name: Log-in to ghcr.io - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin - - - name: Build and push container image - run: | - IMAGE_ID=$(echo ghcr.io/${{ github.repository }} | tr '[A-Z]' '[a-z]') - # Strip git ref prefix from version - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - # Strip "v" prefix from tag name - [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') - # when the branch is master, replace master with latest - [ "$VERSION" == "master" ] && VERSION=latest - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - # Build and Publish container image - docker buildx build --push \ - --tag $IMAGE_ID:$VERSION \ - --platform linux/amd64,linux/arm64,linux/armv7hf ./notecard - balena_cloud_build: runs-on: ubuntu-latest strategy: - fail-fast: true matrix: arch: [aarch64, amd64, armv7hf] @@ -59,7 +24,6 @@ jobs: with: balena_token: ${{ secrets.BALENA_TOKEN }} fleet: arribada/notecard-go-${{ matrix.arch }} - create_tag: true - name: Log release ID built run: echo "Built release ID ${{ steps.build.outputs.release_id }}" diff --git a/notecard/main.go b/notecard/main.go index b923f66..cf1cbb1 100644 --- a/notecard/main.go +++ b/notecard/main.go @@ -29,7 +29,7 @@ func handleError(w http.ResponseWriter, err error, msg string) { } func (s *server) ServeHTTP(w http.ResponseWriter, req *http.Request) { - if s.card == nil || s.initError != nil { + if s.initError != nil { handleError(w, s.initError, "while initialising notecard") log.Fatal("Notecard not initialised, exiting...") } @@ -101,8 +101,9 @@ func main() { card, err := setupNotecard(transport) if err != nil { log.Printf("while setting up notecard: %v", err) + } else { + defer card.Close() } - defer card.Close() http.Handle("/", &server{card: card, initError: err}) http.ListenAndServe(":3434", nil)