How to build kibana RPM from source code using only preinstalled local tools

Questions

  1. How can I build Kibana RPM (only RPM, nothing else is required) using only local tools (build dependencies) that are preinstalled?
    • I want to use --skip-node-download or --prefer-offline (assume that you have all the necessary build tools preinstalled locally, so there is no need to have an internet connection to download further tools)
    • Issue in building Kibana rpm 7.0.1 from src
  2. Is it possible to build this particular RPM from step 1.) without any direct in-code intervention(s)?
    • an elastic discussion noted that there is a need to disable the SHA SUM verification (getNodeShasums)

Related

Environment

Dockerfile (works, but not as expected)

FROM oraclelinux:8

WORKDIR /tmp

# install dependencies
RUN dnf group install -y "Development Tools" && dnf install -y ruby-devel && gem install fpm -v 1.5.0
RUN curl -O https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/getPackage/npm-6.13.4-1.10.19.0.1.module+el8.1.0+5552+3cab52c0.x86_64.rpm
RUN curl -O https://yum.oracle.com/repo/OracleLinux/OL8/appstream/x86_64/getPackage/nodejs-10.19.0-1.module+el8.1.0+5552+3cab52c0.x86_64.rpm
RUN rpm -i npm-6.13.4*.rpm nodejs-10.19.0*.rpm
RUN npm install --global yarn

# USER/GROUP variables
ARG USERID=1000
ARG USERNAME=kibana
ARG GROUPID=1000
ARG USERGROUP=$USERNAME

# create user
RUN groupadd $USERGROUP -g $GROUPID
RUN useradd $USERNAME -u $USERID -g $GROUPID -m -s /bin/bash

USER $USERNAME

# add source code
COPY --chown=$USERID:$GROUPID . /kibana
RUN chmod -R g=u /kibana
RUN find /kibana -type d -exec chmod g+s {} \;

WORKDIR /kibana

# WORKAROUND, see https://github.com/elastic/kibana/issues/46880#issuecomment-729857833
RUN chmod +x /kibana/bin/kibana*

# FIXME
# install kibana dependencies
RUN yarn kbn bootstrap
# RUN yarn kbn bootstrap --prefer-offline

# FIXME
# build kibana
RUN yarn build --rpm
# RUN yarn build --oss --rpm --skip-node-download --skip-archives

This is something we really tried before and configured for. With the change to Bazel i think it could be doable once you have the cache in place after bootstrapping once.