From 92718e5fecf6245e888c928a09fae67041e9c1af Mon Sep 17 00:00:00 2001 From: Paulo Gomes Date: Mon, 7 Feb 2022 18:37:05 +0000 Subject: [PATCH] TEMPORARY waiting for official image Signed-off-by: Paulo Gomes --- .github/workflows/e2e.yaml | 10 +++++++--- Dockerfile | 2 ++ Makefile | 9 +++++---- hack/install-libraries.sh | 6 ++++-- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 33ee1ca4c..015ceed33 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -3,8 +3,8 @@ name: e2e on: pull_request: push: - branches: - - main + # branches: + # - main permissions: contents: read # for actions/checkout to fetch code @@ -57,7 +57,11 @@ jobs: with: go-version: 1.17.x - name: Run tests - run: make test + run: | + mkdir tmp-download; cd tmp-download; go mod init go-download; + GOBIN="${GITHUB_WORKSPACE}/build/gobin" go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest + cd ..; rm -rf tmp-download + make test - name: Prepare id: prep run: | diff --git a/Dockerfile b/Dockerfile index ca9289fef..8388b2801 100644 --- a/Dockerfile +++ b/Dockerfile @@ -108,5 +108,7 @@ RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf COPY --from=build /source-controller /usr/local/bin/ COPY ATTRIBUTIONS.md / +ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt + USER 65534:65534 ENTRYPOINT [ "source-controller" ] diff --git a/Makefile b/Makefile index 552007dd1..17d6609ac 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,8 @@ IMG ?= fluxcd/source-controller TAG ?= latest # Base image used to build the Go binary -LIBGIT2_IMG ?= ghcr.io/fluxcd/golang-with-libgit2 -LIBGIT2_TAG ?= libgit2-1.1.1-4 +LIBGIT2_IMG ?= ghcr.io/pjbgf/golang-with-libgit2 +LIBGIT2_TAG ?= libgit2-1.1.1-6-nostdio # Allows for defining additional Docker buildx arguments, # e.g. '--push'. @@ -35,13 +35,14 @@ export LIBRARY_PATH=$(LIBGIT2_LIB_PATH) export CGO_CFLAGS=-I$(LIBGIT2_PATH)/include -I$(LIBGIT2_PATH)/include/openssl +# The pkg-config command will yield warning messages until libgit2 is downloaded. ifeq ($(shell uname -s),Darwin) -export CGO_LDFLAGS=$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs --static --cflags libssh2 openssl libgit2) +export CGO_LDFLAGS=$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs --static --cflags libssh2 openssl libgit2 2>/dev/null) GO_STATIC_FLAGS=-ldflags "-s -w" -tags 'netgo,osusergo,static_build' else export PKG_CONFIG_PATH:=$(PKG_CONFIG_PATH):$(LIBGIT2_LIB64_PATH)/pkgconfig export LIBRARY_PATH:=$(LIBRARY_PATH):$(LIBGIT2_LIB64_PATH) -export CGO_LDFLAGS=$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs --static --cflags libssh2 openssl libgit2) +export CGO_LDFLAGS=$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs --static --cflags libssh2 openssl libgit2 2>/dev/null) endif diff --git a/hack/install-libraries.sh b/hack/install-libraries.sh index cc5615c3d..229847fee 100755 --- a/hack/install-libraries.sh +++ b/hack/install-libraries.sh @@ -47,17 +47,19 @@ function setup_current() { # For MacOS development environments, download the amd64 static libraries released from from golang-with-libgit2. #TODO: update URL with official URL + TAG: - curl -o output.tar.gz -LO "https://github.com/pjbgf/golang-with-libgit2/releases/download/1.1.1-6/darwin-libs.tar.gz" + curl -o output.tar.gz -LO "https://github.com/pjbgf/golang-with-libgit2/releases/download/${TAG}/darwin-libs.tar.gz" DIR=libgit2-darwin NEW_DIR="$(/bin/pwd)/build/libgit2/${TAG}" INSTALLED_DIR="/Users/runner/work/golang-with-libgit2/golang-with-libgit2/build/${DIR}-amd64" tar -xf output.tar.gz + rm output.tar.gz mv "${DIR}" "${TAG}" mv "${TAG}/" "./build/libgit2" - sed -i "" "s;-L/Applications/Xcode_12.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/lib ;;g" "$(/bin/pwd)/build/libgit2/${TAG}/lib/pkgconfig/libgit2.pc" + # Removes abs path from build machine, and let iconv be resolved automatically by default search paths. + sed -i "" "s;-L/Applications/Xcode_.* ;;g" "$(/bin/pwd)/build/libgit2/${TAG}/lib/pkgconfig/libgit2.pc" # Update the prefix paths included in the .pc files. # This will make it easier to update to the location in which they will be used.