You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.5 KiB

%global _hardened_build 1
%define _user cicd
%define _group cicd
%define _varlib /var/lib/cds/
%define _logdir /var/log/cds/
Name: cds
Version: 0.49.0
Release: 1%{?dist}
Summary: Pipeline
Group: System/Pipeline
License: GPLv2
URL: https://github.com/ovh/cds
BuildRequires: git
BuildRequires: golang
BuildRequires: npm
#Requires:
%description
%package engine
Summary: Engine
%description engine
%package worker
Summary: Worker
%description worker
%package cli
Summary: CLI
%description cli
%prep
%setup -q -T -c %{name}-%{version}
export GOPATH=`pwd`
mkdir -p src/github.com/ovh/
cd src/github.com/ovh/
git clone https://github.com/ovh/cds/
%build
export GOPATH=`pwd`
export GEN_PATH="$GOPATH/src/github.com/ovh/cds/docs/content/docs/components"
export DATE=$(date "+%m/%d/%y-%H:%M:%S")
%ifarch x86_64
export ARCH=amd64
%else
export ARCH=%{_arch}
%endif
cd src/github.com/ovh/cds/
pushd cli/cdsctl
go build -gcflags=all="-N -l" -ldflags "-X github.com/ovh/cds/sdk.VERSION=%{version} -X github.com/ovh/cds/sdk.GOOS=linux -X github.com/ovh/cds/sdk.GOARCH=$ARCH -X github.com/ovh/cds/sdk.GITHASH=%{version} -X github.com/ovh/cds/sdk.BUILDTIME=$DATE -X github.com/ovh/cds/sdk.BINARY=cdscli -extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -o dist/cdscli .
popd
pushd engine
### need to figure out words and wildcard
### export DBMIGRATE=$(words $(wildcard sql/*.sql))
### github.com/ovh/cds/sdk.DBMIGRATE=$DBMIGRATE
go build -ldflags "-X github.com/ovh/cds/sdk.VERSION=%{version} -X github.com/ovh/cds/sdk.GOOS=linux -X github.com/ovh/cds/sdk.GOARCH=$ARCH -X github.com/ovh/cds/sdk.GITHASH=%{version} -X github.com/ovh/cds/sdk.BUILDTIME=$DATE -X github.com/ovh/cds/sdk.BINARY=cds-engine -extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -o dist/cds-engine .
popd
pushd engine/worker
go build -ldflags "-X github.com/ovh/cds/sdk.VERSION=%{version} -X github.com/ovh/cds/sdk.GOOS=linux -X github.com/ovh/cds/sdk.GOARCH=$ARCH -X github.com/ovh/cds/sdk.GITHASH=%{version} -X github.com/ovh/cds/sdk.BUILDTIME=$DATE -X github.com/ovh/cds/sdk.BINARY=cds-worker -extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -o dist/cds-worker .
popd
pushd tools/os-ansible-inventory
go build -ldflags "-X github.com/ovh/cds/sdk.VERSION=%{version} -X github.com/ovh/cds/sdk.GOOS=linux -X github.com/ovh/cds/sdk.GOARCH=$ARCH -X github.com/ovh/cds/sdk.GITHASH=%{version} -X github.com/ovh/cds/sdk.BUILDTIME=$DATE -X github.com/ovh/cds/sdk.BINARY=os-ansible-inventory -extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -o dist/os-ansible-inventory .
popd
pushd ui
rm -rf package-lock.json
sed '/sentry/d' -i package.json
sed 's|"build:analyse": "webpack-bundle-analyzer dist/stats.json",|"build:analyse": "webpack-bundle-analyzer dist/stats.json"|' -i package.json
npm install
npm install ng
NODE_OPTIONS="--max-old-space-size=8192" node_modules/@angular/cli/bin/ng build --prod
popd
%install
mkdir -p %{buildroot}%{_bindir}
cp src/github.com/ovh/cds/cli/cdsctl/dist/cdscli %{buildroot}%{_bindir}
cp src/github.com/ovh/cds/engine/worker/dist/cds-worker %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_varlib}
cp src/github.com/ovh/cds/engine/dist/cds-engine %{buildroot}%{_varlib}
cp src/github.com/ovh/cds/tools/os-ansible-inventory/dist/os-ansible-inventory %{buildroot}%{_varlib}
cp -rv src/github.com/ovh/cds/ui/dist/ %{buildroot}%{_varlib}/ui/
%files
%files engine
%{_varlib}/cds-engine
%{_varlib}/os-ansible-inventory
%{_varlib}/ui/
%files worker
%{_bindir}/cds-worker
%files cli
%{_bindir}/cdscli
%changelog