diff --git a/.github/workflows/ci_build_test.yaml b/.github/workflows/ci_build_test.yaml index 6b65488..44c1b3e 100644 --- a/.github/workflows/ci_build_test.yaml +++ b/.github/workflows/ci_build_test.yaml @@ -74,10 +74,38 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Build kubernetes-metrics image + - name: Prepare container build + id: prep + run: | + VERSION=`cat VERSION` + TAGS=splunk/k8s-metrics:recent + + echo ::set-output name=tags::${TAGS} + echo ::set-output name=version::${VERSION} + + - name: Set up QEMU + uses: docker/setup-qemu-action@master + with: + platforms: all + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@master + + - name: Build multi-arch kubernetes-metrics image + uses: docker/build-push-action@v2 + with: + builder: ${{ steps.buildx.outputs.name }} + context: . + file: ./docker/Dockerfile + platforms: linux/amd64 + push: false + load: true + tags: ${{ steps.prep.outputs.tags }} + build-args: VERSION=${{ steps.prep.outputs.version }} + + - name: Check kubernetes-metrics image run: | - sed -i 's/VERSION=$VERSION -t splunk\/k8s-metrics:$TAG .\/docker/VERSION=$VERSION -t k8s-metrics:$TAG .\/docker/' docker/build.sh - sudo docker/build.sh $GITHUB_RUN_ID docker image ls - name: Setup Minikube diff --git a/ci_scripts/deploy_connector.sh b/ci_scripts/deploy_connector.sh index 2af97c1..b2d5a55 100755 --- a/ci_scripts/deploy_connector.sh +++ b/ci_scripts/deploy_connector.sh @@ -14,14 +14,16 @@ cd /opt git clone https://github.com/splunk/splunk-connect-for-kubernetes.git cd splunk-connect-for-kubernetes +minikube image load splunk/k8s-metrics:recent + echo "Deploying k8s-connect with latest changes" helm install ci-sck --set global.splunk.hec.token=$CI_SPLUNK_HEC_TOKEN \ --set global.splunk.hec.host=$CI_SPLUNK_HOST \ --set kubelet.serviceMonitor.https=true \ ---set splunk-kubernetes-metrics.image.repository=k8s-metrics \ +--set splunk-kubernetes-metrics.image.tag=recent \ --set splunk-kubernetes-metrics.image.pullPolicy=IfNotPresent \ -f ci_scripts/sck_values.yml helm-chart/splunk-connect-for-kubernetes #wait for deployment to finish until kubectl get pod | grep Running | [[ $(wc -l) == 4 ]]; do sleep 1; -done \ No newline at end of file +done diff --git a/docker/Dockerfile b/docker/Dockerfile index 8016370..910e4d4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,3 +1,13 @@ +FROM ruby:2.7.4-buster as builder + +ADD ./ /app/ +WORKDIR /app +RUN gem install bundler +RUN bundle update --bundler +RUN bundle install + +RUN bundle exec rake build -t -v + FROM registry.access.redhat.com/ubi8/ruby-27 ARG VERSION @@ -15,10 +25,12 @@ ENV FLUENT_USER fluent USER root -COPY *.gem /tmp/ -COPY licenses /licenses +COPY --from=builder /app/pkg/fluent-plugin-*.gem /tmp/ + +RUN mkdir /licenses +COPY --from=builder /app/LICENSE /licenses/LICENSE -COPY Gemfile* ./ +COPY --from=builder /app/docker/Gemfile* ./ RUN yum update -y \ && yum remove -y nodejs npm \ && gem install bundler \