console icon indicating copy to clipboard operation
console copied to clipboard

To start migrating our tests to the Datacenter in containers

Open cniackz opened this issue 3 years ago • 1 comments

Objective: To start migrating our tests to containers in our Datacenter.

  • This was tested in my fork: https://github.com/cniackz/console/runs/7776531245?check_suite_focus=true

  • The container image will already have go and golangci-lint, saving a lot of time in execution time.

  • It is expected Workflow / Checking Lint (pull_request) to fail, as I need Daniel to add the runner below:

FROM ubuntu:latest

# Define any needed environmental variable
# Allowing root to be a runner user
ENV RUNNER_ALLOW_RUNASROOT="1"

# Avoid user interaction
# https://askubuntu.com/questions/909277/avoiding-user-interaction-with-tzdata-when-installing-certbot-in-a-docker-contai
ARG DEBIAN_FRONTEND=noninteractive

# Install all relevant packages for our Runners to work and debug
RUN apt update
RUN apt install -y curl
RUN apt install -y bash 
RUN apt install -y make
RUN apt install -y git-all
RUN apt install -y wget
RUN apt install -y build-essential
RUN apt install -y vim
RUN apt install -y iputils-ping

# Install GoLang for a faster execution
RUN wget https://go.dev/dl/go1.19.linux-amd64.tar.gz
RUN rm -rf /usr/local/go
RUN tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz
RUN mv /usr/local/go/bin/go /usr/local/bin/go
RUN mv /usr/local/go/bin/gofmt /usr/local/bin/gofmt

# Install golangci-lint to get proper compiled version for the container:
# https://github.com/golangci/golangci-lint/discussions/2215
RUN git clone https://github.com/golangci/golangci-lint.git /root/golangci-lint
RUN cd /root/golangci-lint && make build
RUN cd /root/golangci-lint && chmod +x golangci-lint
RUN cd /root/golangci-lint && mv golangci-lint /usr/bin/golangci-lint

# Install Packages needed for the GitHub Runner to work
RUN curl https://packages.microsoft.com/config/ubuntu/21.04/packages-microsoft-prod.deb -O
RUN dpkg -i packages-microsoft-prod.deb
RUN apt update
RUN apt install -y apt-transport-https
RUN apt install -y dotnet-sdk-6.0

# Add Runner
RUN mkdir -p /actions-runner
RUN cd /actions-runner && curl -o actions-runner-linux-x64-2.294.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.294.0/actions-runner-linux-x64-2.294.0.tar.gz
RUN cd /actions-runner && tar xzf ./actions-runner-linux-x64-2.294.0.tar.gz

Additional information:

https://github.com/golangci/golangci-lint/discussions/2215

cniackz avatar Aug 10 '22 22:08 cniackz

0s
Run make lint-for-containers
make: go: No such file or directory
Running lint-for-containers check in container:
/bin/sh: [1](https://github.com/minio/console/runs/7794942657?check_suite_focus=true#step:3:1): /usr/bin/golangci-lint: not found
make: *** [Makefile:46: lint-for-containers] Error 12[7](https://github.com/minio/console/runs/7794942657?check_suite_focus=true#step:3:8)
Error: Process completed with exit code 2.

Linter job is faiing @cniackz

harshavardhana avatar Aug 17 '22 20:08 harshavardhana

Thank you Harsha, I am checking the failure to understand why it failed and how to make it work here.

cniackz avatar Aug 23 '22 15:08 cniackz

Hello @harshavardhana and @dvaldivia

I have created a twin repository from console called twin, you can find it here: https://github.com/cniackz/twin In this twin repository same change was tested in the runner created from Dockerfile in this PR and it works: https://github.com/cniackz/twin/pull/1

Screen Shot 2022-08-23 at 1 03 30 PM Screen Shot 2022-08-23 at 1 03 48 PM

My best guess is that the runner added in console repository is not the same as the one I created with the Dockerfile. Hence I will request temporal access to add proper runner for us to see that this is working and also if we start using labels on runners, then we can manage to have several types for different tasks as in our enterprise version.

Anyway, will synch with Daniel and Harsha on this, so that I can gain access to add runner.

cniackz avatar Aug 23 '22 17:08 cniackz

Ok @dvaldivia helped me to add the runner and now test is working as intended:

Workflow / Checking Lint (1.19.x, ubuntu-latest) (pull_request)

Run make lint-for-containers
Running lint-for-containers check in container:
level=warning msg="[runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter.  Replaced by unused."
level=warning msg="[runner] The linter 'varcheck' is deprecated (since v1.4[9](https://github.com/minio/console/runs/7983861547?check_suite_focus=true#step:3:10).0) due to: The owner seems to have abandoned the linter.  Replaced by unused."
level=warning msg="[runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter.  Replaced by unused."

We should address those warnings in a separate PR

cniackz avatar Aug 23 '22 22:08 cniackz

Closing this PR, I don't like the idea of having different Job for self-hosted runners. What I would like to achieve here is to have the same Job for both type of runners.

cniackz avatar Aug 24 '22 19:08 cniackz