Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Feature/packaging #169

Merged
merged 114 commits into from
Jun 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
b86c435
adding initial packagin
viniciusramosdefaria May 28, 2020
245a761
adding debian packagin
viniciusramosdefaria Jun 1, 2020
07ad32d
.
viniciusramosdefaria Jun 1, 2020
d921675
.
viniciusramosdefaria Jun 1, 2020
3c24a03
.
viniciusramosdefaria Jun 1, 2020
6d393b0
.
viniciusramosdefaria Jun 1, 2020
51e9f27
.
viniciusramosdefaria Jun 1, 2020
7e4161e
.
viniciusramosdefaria Jun 1, 2020
d26e040
.'
viniciusramosdefaria Jun 1, 2020
09201cc
Merge branch 'master' of github.com:ZupIT/ritchie-cli into feature/pa…
viniciusramosdefaria Jun 1, 2020
c639243
.
viniciusramosdefaria Jun 1, 2020
0f4e023
.
viniciusramosdefaria Jun 1, 2020
158f6af
.
viniciusramosdefaria Jun 1, 2020
80e7ff9
.
viniciusramosdefaria Jun 1, 2020
b22a0a2
.'
viniciusramosdefaria Jun 1, 2020
d8dc213
.'
viniciusramosdefaria Jun 1, 2020
5a66d00
.
viniciusramosdefaria Jun 1, 2020
cd6d52c
.
viniciusramosdefaria Jun 1, 2020
000a5fb
.
viniciusramosdefaria Jun 1, 2020
2a1e320
.
viniciusramosdefaria Jun 1, 2020
8c75667
.
viniciusramosdefaria Jun 1, 2020
368b5b5
.
viniciusramosdefaria Jun 1, 2020
d23995e
.
viniciusramosdefaria Jun 1, 2020
3d45ab7
.
viniciusramosdefaria Jun 1, 2020
7464f2b
.
viniciusramosdefaria Jun 1, 2020
299acbe
.
viniciusramosdefaria Jun 2, 2020
8bfd53f
adding windows files
viniciusramosdefaria Jun 2, 2020
c12c114
adding required things to build msi and choco
viniciusramosdefaria Jun 2, 2020
51fc248
.
viniciusramosdefaria Jun 3, 2020
e2c6289
.
viniciusramosdefaria Jun 3, 2020
cc20fa2
.
viniciusramosdefaria Jun 3, 2020
5f834b1
.
viniciusramosdefaria Jun 3, 2020
c39dbf8
.
viniciusramosdefaria Jun 3, 2020
a8037f7
.
viniciusramosdefaria Jun 3, 2020
7e92255
.
viniciusramosdefaria Jun 3, 2020
be84939
.
viniciusramosdefaria Jun 3, 2020
64adccd
.
viniciusramosdefaria Jun 3, 2020
31b1298
.
viniciusramosdefaria Jun 3, 2020
aa4bb0f
.
viniciusramosdefaria Jun 3, 2020
a485ef9
.
viniciusramosdefaria Jun 3, 2020
592fb74
.
viniciusramosdefaria Jun 3, 2020
e717f4c
.
viniciusramosdefaria Jun 3, 2020
2038495
.
viniciusramosdefaria Jun 3, 2020
39de593
.
viniciusramosdefaria Jun 3, 2020
099572f
.
viniciusramosdefaria Jun 3, 2020
c7b87a3
.
viniciusramosdefaria Jun 3, 2020
773c1d1
.
viniciusramosdefaria Jun 3, 2020
7cef1e6
.
viniciusramosdefaria Jun 3, 2020
4e0256d
.
viniciusramosdefaria Jun 3, 2020
43e043f
.
viniciusramosdefaria Jun 3, 2020
2b1a84b
.
viniciusramosdefaria Jun 3, 2020
e28e538
.
viniciusramosdefaria Jun 3, 2020
35dc114
.
viniciusramosdefaria Jun 3, 2020
043d784
.
viniciusramosdefaria Jun 3, 2020
66b884b
.
viniciusramosdefaria Jun 3, 2020
634bfc0
.
viniciusramosdefaria Jun 3, 2020
9680246
.
viniciusramosdefaria Jun 3, 2020
95f23a7
.
viniciusramosdefaria Jun 3, 2020
29c9643
.
viniciusramosdefaria Jun 3, 2020
11ca3a1
.
viniciusramosdefaria Jun 3, 2020
3df89a1
.
viniciusramosdefaria Jun 3, 2020
1ee0bf2
.
viniciusramosdefaria Jun 3, 2020
3d55535
.
viniciusramosdefaria Jun 3, 2020
a5cd038
.
viniciusramosdefaria Jun 3, 2020
32979b4
.
viniciusramosdefaria Jun 3, 2020
56734db
.
viniciusramosdefaria Jun 3, 2020
c7b0064
.
viniciusramosdefaria Jun 3, 2020
8fa8e08
.
viniciusramosdefaria Jun 3, 2020
953bd37
.
viniciusramosdefaria Jun 3, 2020
dcaedd4
.
viniciusramosdefaria Jun 3, 2020
1ee9428
.
viniciusramosdefaria Jun 3, 2020
889ef84
.
viniciusramosdefaria Jun 3, 2020
2653e95
.
viniciusramosdefaria Jun 3, 2020
9798928
.
viniciusramosdefaria Jun 3, 2020
7dab57e
.
viniciusramosdefaria Jun 3, 2020
dee7254
.
viniciusramosdefaria Jun 3, 2020
b6d9fff
.
viniciusramosdefaria Jun 3, 2020
ce05653
.
viniciusramosdefaria Jun 3, 2020
e1b4066
.
viniciusramosdefaria Jun 3, 2020
d38114c
.
viniciusramosdefaria Jun 3, 2020
833c4f8
.
viniciusramosdefaria Jun 3, 2020
3dcd5dc
.
viniciusramosdefaria Jun 3, 2020
8d738f8
.
viniciusramosdefaria Jun 3, 2020
c4a912b
add pre and post deb
ernelio Jun 4, 2020
7e876a9
changes
ernelio Jun 4, 2020
259694c
.
ernelio Jun 4, 2020
9a7a71b
.
ernelio Jun 4, 2020
a7e7074
.
ernelio Jun 4, 2020
023aa91
.
ernelio Jun 4, 2020
317f421
changes
ernelio Jun 4, 2020
7cf4c1c
add pre and post in version single and team
ernelio Jun 4, 2020
5c90e75
add rpm in pre and post
ernelio Jun 4, 2020
a08d8f7
fix deb-single
ernelio Jun 4, 2020
6c1bacf
.
ernelio Jun 5, 2020
02018ea
.
viniciusramosdefaria Jun 5, 2020
c1ec867
.
viniciusramosdefaria Jun 5, 2020
c1b4ab7
.
viniciusramosdefaria Jun 5, 2020
d1c5716
.
viniciusramosdefaria Jun 8, 2020
021e3d0
ritchieclizup
ernelio Jun 17, 2020
b882508
.
viniciusramosdefaria Jun 17, 2020
80d73df
adding stuff to test
viniciusramosdefaria Jun 17, 2020
a7784b1
adding stuff to test
viniciusramosdefaria Jun 17, 2020
33553f2
.
viniciusramosdefaria Jun 17, 2020
fb3316e
Merge branch 'master' of github.com:ZupIT/ritchie-cli into feature/pa…
viniciusramosdefaria Jun 17, 2020
5406f30
.
viniciusramosdefaria Jun 17, 2020
c0a4262
.
viniciusramosdefaria Jun 17, 2020
d9673ff
.
viniciusramosdefaria Jun 17, 2020
cfe635d
trimming unnecessary files
viniciusramosdefaria Jun 17, 2020
8c99ade
trimming unecessary files
viniciusramosdefaria Jun 17, 2020
0cfb3c1
trimming unnecessary files
viniciusramosdefaria Jun 17, 2020
0377e59
trimming unnecessary files
viniciusramosdefaria Jun 17, 2020
3724a96
trimming unnecessary files
viniciusramosdefaria Jun 17, 2020
69420a3
Merge branch 'feature/packaging' of github.com:viniciusramosdefaria/r…
viniciusramosdefaria Jun 17, 2020
0e96c94
adding echo
viniciusramosdefaria Jun 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 91 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ references:
ruby: &RUBY_IMAGE cimg/ruby:2.6.5
ci_machine: &CI_MACHINE_IMAGE ubuntu-1604:202004-01
horus: &HORUS_IMAGE library/docker:dind
ubuntu: &UBUNTU_IMAGE cimg/base:2020.01
centos: &CENTOS_IMAGE viniciusramosdefaria/centos-circleci:7.0
windows: &WINDOWS_IMAGE windows-server-2019

paths:
test-results: &TEST_RESULTS_DIR bin
Expand Down Expand Up @@ -75,7 +78,19 @@ executors:
resource_class: windows.medium
shell: powershell.exe -ExecutionPolicy Unrestricted
machine:
image: windows-server-2019
image: *WINDOWS_IMAGE

ubuntu-executor:
docker:
- image: *UBUNTU_IMAGE
user: root
working_directory: /workspace

centos-executor:
docker:
- image: *CENTOS_IMAGE
user: root
working_directory: /workspace

jobs:
lint:
Expand Down Expand Up @@ -259,6 +274,63 @@ jobs:
. ./.circleci/scripts/credentials.sh
make delivery

deb-package:
environment:
<<: *ENVIRONMENT
executor: ubuntu-executor
steps:
- checkout
- attach_workspace:
at: /workspace/dist
- run:
name: Generating package for debian
command: |
. ./.circleci/scripts/version.sh
. ./.circleci/scripts/gen-deb.sh
- persist_to_workspace:
root: dist
paths:
- installer

rpm-package:
environment:
<<: *ENVIRONMENT
executor: centos-executor
steps:
- checkout
- attach_workspace:
at: /workspace/dist
- run:
name: Generating package for rpm
command: |
. ./.circleci/scripts/version.sh
. ./.circleci/scripts/gen-rpm.sh
- persist_to_workspace:
root: dist
paths:
- installer

win-package:
executor:
name: windows-executor
steps:
- checkout
- attach_workspace:
at: /workspace/dist
- run:
command: |
. ./.circleci/scripts/version.sh
echo $RELEASE_VERSION > release_version.txt
shell: bash.exe
- run:
command: |
.circleci/scripts/gen-win.ps1
shell: powershell.exe
- persist_to_workspace:
root: dist
paths:
- installer

release:
environment:
<<: *ENVIRONMENT
Expand Down Expand Up @@ -454,4 +526,21 @@ workflows:
<<: *FILTERS_DELIVERY
requires:
- build-code

- deb-package
- rpm-package
- win-package
- deb-package:
filters:
<<: *FILTERS_DELIVERY
requires:
- build-code
- rpm-package:
filters:
<<: *FILTERS_DELIVERY
requires:
- build-code
- win-package:
filters:
<<: *FILTERS_DELIVERY
requires:
- build-code
4 changes: 4 additions & 0 deletions .circleci/scripts/credentials.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ elif expr "$CIRCLE_BRANCH" : '^beta' >/dev/null; then
export AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID_PROD"
export AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY_PROD"

elif expr "$CIRCLE_BRANCH" : '^feature/packaging' >/dev/null; then
export AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID_PROD"
export AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY_PROD"

else
echo ""
fi
11 changes: 11 additions & 0 deletions .circleci/scripts/gen-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh


mkdir -p dist/installer

curl -fsSL https://raw.githubusercontent.com/mh-cbon/latest/master/install.sh | GH=mh-cbon/go-bin-deb sh -xe
go-bin-deb generate --file packaging/debian/deb-single.json --version ${RELEASE_VERSION} -o dist/installer/ritchie-single.deb -a amd64
rm -rf pkg-build
go-bin-deb generate --file packaging/debian/deb-team.json --version ${RELEASE_VERSION} -o dist/installer/ritchie-team.deb -a amd64
rm -rf pkg-build
go-bin-deb generate --file packaging/debian/deb-team-zup.json --version ${RELEASE_VERSION} -o dist/installer/ritchie-team-zup.deb -a amd64
23 changes: 23 additions & 0 deletions .circleci/scripts/gen-rpm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

changelog init

mkdir -p pkg-build/SPECS

echo ${RELEASE_VERSION}

mkdir -p dist/installer

go-bin-rpm generate-spec --file packaging/rpm/rpm-team.json -a amd64 --version ${RELEASE_VERSION} > pkg-build/SPECS/ritchiecli.spec
go-bin-rpm generate --file packaging/rpm/rpm-team.json -a amd64 --version ${RELEASE_VERSION} -o dist/installer/ritchie-team.rpm

rm -rf pkg-build && mkdir -p pkg-build/SPECS

go-bin-rpm generate-spec --file packaging/rpm/rpm-single.json -a amd64 --version ${RELEASE_VERSION} > pkg-build/SPECS/ritchiecli.spec
go-bin-rpm generate --file packaging/rpm/rpm-single.json -a amd64 --version ${RELEASE_VERSION} -o dist/installer/ritchie-single.rpm

rm -rf pkg-build && mkdir -p pkg-build/SPECS

go-bin-rpm generate-spec --file packaging/rpm/rpm-team-zup.json -a amd64 --version ${RELEASE_VERSION} > pkg-build/SPECS/ritchiecli.spec
go-bin-rpm generate --file packaging/rpm/rpm-team-zup.json -a amd64 --version ${RELEASE_VERSION} -o dist/installer/ritchie-team-zup.rpm

78 changes: 78 additions & 0 deletions .circleci/scripts/gen-win.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@

Write-Output 'DOWLOADING GO-MSI INSTALLER'

$url = "https://github.com/mh-cbon/go-msi/releases/download/1.0.2/go-msi-amd64.msi"
$output = "$((Get-Item -Path ".\").FullName)\go-msi-amd64.msi"
$start_time = Get-Date

$wc = New-Object System.Net.WebClient
$wc.DownloadFile($url, $output)

Write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"

Write-Output 'INSTALLING GO-MSI'

Start-Process msiexec.exe -Wait -ArgumentList "/I $output /quiet"

Write-Output 'DOWLOADING WIX FILES'

$url = "http://wixtoolset.org/downloads/v3.10.3.3007/wix310-binaries.zip"
$output = "$((Get-Item -Path ".\").FullName)\wix310-binaries.zip"
$start_time = Get-Date

$wc = New-Object System.Net.WebClient
$wc.DownloadFile($url, $output)

Write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"

Add-Type -AssemblyName System.IO.Compression.FileSystem
function Unzip
{
param([string]$zipfile, [string]$outpath)

[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
}

Write-Output 'EXTRACTING WIX FILES TO PATH'

Unzip "$((Get-Item -Path ".\").FullName)\wix310-binaries.zip" "C:\\Users\circleci\AppData\Local\Microsoft\WindowsApps"

Write-Output 'Setting Release Version Variable'

$release_version=$(Get-Content .\release_version.txt)

mkdir dist\installer

copy LICENSE packaging/windows

cd packaging\windows

Write-Output 'GENERATING MSI TEAM INSTALLER'

& 'C:\Program Files\go-msi\go-msi.exe' make --msi ritchiecliteam.msi --version $release_version --path wix-team.json

Write-Output 'GENERATING CHOCO TEAM INSTALLER'

& 'C:\Program Files\go-msi\go-msi.exe' choco --version $release_version"-team" --input ritchiecliteam.msi --path wix-team.json

Write-Output 'GENERATING MSI SINGLE INSTALLER'

& 'C:\Program Files\go-msi\go-msi.exe' make --msi ritchieclisingle.msi --version $release_version --path wix-single.json

Write-Output 'GENERATING CHOCO SINGLE INSTALLER'

& 'C:\Program Files\go-msi\go-msi.exe' choco --version $release_version"-single" --input ritchieclisingle.msi --path wix-single.json

Write-Output 'GENERATING MSI TEAM ZUP INSTALLER'

& 'C:\Program Files\go-msi\go-msi.exe' make --msi ritchiecliteamzup.msi --version $release_version --path wix-team-zup.json

Write-Output 'GENERATING CHOCO TEAM ZUP INSTALLER'

& 'C:\Program Files\go-msi\go-msi.exe' choco --version $release_version"-teamzup" --input ritchiecliteamzup.msi --path wix-team-zup.json

Write-Output 'COPYING FILES TO THE RIGHT PLACE'

copy ritchie* ..\..\dist\installer

copy *.nupkg ..\..\dist\installer
2 changes: 1 addition & 1 deletion .circleci/scripts/gonna_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

DEPLOYED_VERSION=$(curl -s https://commons-repo.ritchiecli.io/stable.txt)

VERSION_TO_CHECK_AGAINST=$($VERSION_PLACEHOLDER | sed "s/PLACEHOLDER//")
VERSION_TO_CHECK_AGAINST=$(echo "$VERSION_PLACEHOLDER" | sed "s/PLACEHOLDER//")

if [ "$DEPLOYED_VERSION" == "$VERSION_TO_CHECK_AGAINST" ]; then
echo "RELEASE"
Expand Down
2 changes: 2 additions & 0 deletions .circleci/scripts/ritchie_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ elif expr "$VERSION" : '^nightly' >/dev/null; then
echo "https://ritchie-server.zup.io"
elif expr "$VERSION" : '^beta' >/dev/null; then
echo "https://ritchie-server.zup.io"
elif expr "$CIRCLE_BRANCH" : '^feature/packaging' >/dev/null; then
echo "https://ritchie-server.zup.io"
else
echo ""
fi
2 changes: 2 additions & 0 deletions .circleci/scripts/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ elif expr "$CIRCLE_BRANCH" : '^nightly' >/dev/null; then
export RELEASE_VERSION="nightly"
elif expr "$CIRCLE_BRANCH" : '^beta' >/dev/null; then
export RELEASE_VERSION="$(.circleci/scripts/beta.sh)"
elif expr "$CIRCLE_BRANCH" : '^feature/packaging' >/dev/null; then
export RELEASE_VERSION="1.0.0-test.1"
else
export RELEASE_VERSION=$(curl https://commons-repo.ritchiecli.io/stable.txt)
echo ""
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,5 @@ Temporary Items

# Jenkins mvn
settings.xml
/change.log
/pkg-build/
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[![CircleCI](https://circleci.com/gh/ZupIT/ritchie-cli/tree/master.svg?style=svg)](https://circleci.com/gh/ZupIT/ritchie-cli) [![codecov](https://codecov.io/gh/zupit/ritchie-cli/branch/master/graph/badge.svg)](https://codecov.io/gh/zupit/ritchie-cli) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)


<img class="special-img-class" src="/docs/img/ritchie-banner.png" />

## Ritchie
Expand Down
16 changes: 16 additions & 0 deletions packaging/Dockerfile-Centos
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM centos:7

# Install needed software and users
USER root
RUN groupadd -r circleci && useradd -r -d /home/circleci -m -g circleci circleci

RUN curl -s -L https://bintray.com/mh-cbon/rpm/rpm > /etc/yum.repos.d/w.repo

RUN yum install -y epel-release && \
yum install -y git tar curl wget sudo make yum-utils device-mapper-persistent-data lvm2 && \
yum clean all && \
yum install go-bin-rpm changelog rpm-build -y --quiet

RUN echo "%circleci ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

USER circleci
15 changes: 15 additions & 0 deletions packaging/debian/deb-single.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "ritchiecli",
"maintainer": "viniciusramosdefaria <viniciusramosdefaria@gmail.com>",
"description": "Install ritchie CLI",
"homepage": "https://ritchiecli.io",
"files": [
{
"from": "dist/linux/single/rit",
"to": "/usr/local/bin",
"base": "dist/linux/single",
"fperm": "0755"
}
],
"preinst-file": "packaging/scripts/preinst.sh"
}
16 changes: 16 additions & 0 deletions packaging/debian/deb-team-zup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "ritchiecli",
"maintainer": "viniciusramosdefaria <viniciusramosdefaria@gmail.com>",
"description": "Install ritchie CLI",
"homepage": "https://ritchiecli.io",
"files": [
{
"from": "dist/linux/team/rit",
"to": "/usr/local/bin",
"base" : "dist/linux/team",
"fperm": "0755"
}
],
"preinst-file": "packaging/scripts/preinst.sh",
"postinst-file": "packaging/scripts/postinst-zup.sh"
}
16 changes: 16 additions & 0 deletions packaging/debian/deb-team.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "ritchiecli",
"maintainer": "viniciusramosdefaria <viniciusramosdefaria@gmail.com>",
"description": "Install ritchie CLI",
"homepage": "https://ritchiecli.io",
"files": [
{
"from": "dist/linux/team/rit",
"to": "/usr/local/bin",
"base" : "dist/linux/team",
"fperm": "0755"
}
],
"preinst-file": "packaging/scripts/preinst.sh",
"postinst-file": "packaging/scripts/postinst.sh"
}
17 changes: 17 additions & 0 deletions packaging/rpm/rpm-single.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "ritchiecli",
"summary": "RitchieCLI installer",
"description": "Install ritchie CLI",
"license": "LICENSE",
"changelog-cmd": "changelog rpm",
"url": "https://github.com/ZupIT/ritchie-cli",
"files": [
{
"from": "dist/linux/single/rit",
"to": "/usr/local/bin",
"base": "dist/linux/single",
"type": ""
}
],
"preinst": "packaging/scripts/preinst.sh"
}
18 changes: 18 additions & 0 deletions packaging/rpm/rpm-team-zup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "ritchiecli",
"summary": "RitchieCLI installer",
"description": "Install ritchie CLI",
"license": "LICENSE",
"changelog-cmd": "changelog rpm",
"url": "https://github.com/ZupIT/ritchie-cli",
"files": [
{
"from": "dist/linux/team/rit",
"to": "/usr/local/bin",
"base": "dist/linux/team",
"type": ""
}
],
"preinst": "packaging/scripts/preinst.sh",
"postinst": "packaging/scripts/postinst-zup.sh"
}
Loading