diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dbccdb10da..8ccd6a6827 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,8 +8,6 @@ on: branches: - '*' -# pull buildargs out of container (stop putting git in) -# can then go back to matrix build of containers jobs: # Run the CI tests @@ -88,7 +86,7 @@ jobs: ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/gateway:${{ steps.get_tag.outputs.TAG }} ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/gateway:${{ github.sha }} ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/gateway:latest - build-auth-containers: + build-auth-plugins: runs-on: ubuntu-latest strategy: matrix: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000000..c5e8501863 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,88 @@ +name: piblish + +on: + push: + tags: + - '*' + +jobs: + + publish-gateway: + runs-on: ubuntu-latest + strategy: + matrix: + go-version: [1.13.x] + steps: + - uses: actions/checkout@master + with: + fetch-depth: 1 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to Docker Registry + uses: docker/login-action@v1 + with: + username: ${{ github.repository_owner }} + password: ${{ secrets.DOCKER_PASSWORD }} + registry: ghcr.io + - name: Get TAG + id: get_tag + run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} + - name: Get Repo Owner + id: get_repo_owner + run: echo ::set-output name=repo_owner::$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') + - name: Build ${{ matrix.svc }} + uses: docker/build-push-action@v2 + with: + context: ./gateway + file: ./gateway/Dockerfile + outputs: "type=registry,push=true" + platforms: linux/amd64,linux/arm/v7,linux/arm64 + build-args: | + VERSION=${{ steps.get_tag.outputs.TAG }} + GIT_COMMIT=${{ github.sha }} + GIT_COMMIT_MESSAGE=${{ github.event.head_commit.message }} + tags: | + ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/gateway:${{ steps.get_tag.outputs.TAG }} + ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/gateway:${{ github.sha }} + ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/gateway:latest + publish-auth-plugins: + runs-on: ubuntu-latest + strategy: + matrix: + go-version: [1.13.x] + svc: [ + basic-auth + ] + steps: + - uses: actions/checkout@master + with: + fetch-depth: 1 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Get TAG + id: get_tag + run: echo ::set-output name=TAG::latest-dev + - name: Login to Docker Registry + uses: docker/login-action@v1 + with: + username: ${{ github.repository_owner }} + password: ${{ secrets.DOCKER_PASSWORD }} + registry: ghcr.io + - name: Get Repo Owner + id: get_repo_owner + run: echo ::set-output name=repo_owner::$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') + - name: Build ${{ matrix.svc }} + uses: docker/build-push-action@v2 + with: + context: ./auth/${{ matrix.svc }} + file: ./auth/${{ matrix.svc }}/Dockerfile + outputs: "type=registry,push=true" + platforms: linux/amd64,linux/arm/v7,linux/arm64 + tags: | + ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/${{ matrix.svc }}:${{ steps.get_tag.outputs.TAG }} + ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/${{ matrix.svc }}:${{ github.sha }} + ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/${{ matrix.svc }}:latest diff --git a/gateway/Dockerfile b/gateway/Dockerfile index a2f67408a7..358e656151 100644 --- a/gateway/Dockerfile +++ b/gateway/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=${BUILDPLATFORM:-linux/amd64} teamserverless/license-check:0.3.6 as license-check +FROM --platform=${BUILDPLATFORM:-linux/amd64} teamserverless/license-check:0.3.9 as license-check FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.13 as build @@ -68,8 +68,10 @@ ENV https_proxy "" COPY --from=build /go/src/github.com/openfaas/faas/gateway/gateway . COPY assets assets -RUN sed -ie s/x86_64/${GOARCH}/g assets/script/funcstore.js && \ - rm assets/script/funcstore.jse + +ARG TARGETPLATFORM + +RUN if [ "$TARGETPLATFORM" = "linux/arm/v7" ] ; then sed -ie s/x86_64/armhf/g assets/script/funcstore.js ; elif [ "$TARGETPLATFORM" = "linux/arm64" ] ; then sed -ie s/x86_64/arm64/g assets/script/funcstore.js; fi RUN chown -R app:app ./ diff --git a/gateway/scaling/function_cache_test.go b/gateway/scaling/function_cache_test.go index 7b55c795a4..a075325e71 100644 --- a/gateway/scaling/function_cache_test.go +++ b/gateway/scaling/function_cache_test.go @@ -81,7 +81,7 @@ func Test_CacheFunctionExists(t *testing.T) { cache := FunctionCache{ Cache: make(map[string]*FunctionMeta), - Expiry: time.Millisecond * 10, + Expiry: time.Millisecond * 100, } cache.Set(fnName, namespace, ServiceQueryResponse{AvailableReplicas: 1}) @@ -102,7 +102,7 @@ func Test_CacheFunctionExistsWithNamespace(t *testing.T) { cache := FunctionCache{ Cache: make(map[string]*FunctionMeta), - Expiry: time.Millisecond * 10, + Expiry: time.Millisecond * 100, } cache.Set(fnName, namespace, ServiceQueryResponse{AvailableReplicas: 1}) @@ -123,7 +123,7 @@ func Test_CacheFunctionNotExist(t *testing.T) { cache := FunctionCache{ Cache: make(map[string]*FunctionMeta), - Expiry: time.Millisecond * 10, + Expiry: time.Millisecond * 100, } cache.Set(fnName, namespace, ServiceQueryResponse{AvailableReplicas: 1})