Commit f38bea41 authored by Carlos Juliano Viana's avatar Carlos Juliano Viana
Browse files

Alterar os arquivos rockspec para informar a versão o SGA. Atualizando o...

Alterar os arquivos rockspec para informar a versão o SGA. Atualizando o arquivo README para descrever como pode-se consultar a versão do SGA usando comando do luarocks.

[SOMA-4153]
[SOMA-3699]
parent 7a737090
include:
local: 'docker.gitlab-ci.yml'
variables:
DOCKER_HOST: tcp://localhost:2375
DOCKER_DRIVER: overlay2
stages:
- version
- build
- deploy
versioning:
stage: version
image: docker:19.03.4
artifacts:
paths:
- shared-vars.sh
expire_in: 1 day
script:
- echo "export VERSION=$(cat sga-daemon-*.rockspec | grep 'version[[:space:]]=[[:space:]]' | awk '{print $3}' | sed -e s/[\",]//g)" >> shared-vars.sh
only:
- master
- tags
static_check:
stage: build
image: repo.tecgraf.puc-rio.br:18089/soma/ubuntu:16.04-sga-posix
script:
- mkdir sgarest-daemon
- curl -L https://git.tecgraf.puc-rio.br/csbase-dev/sgarest-daemon/-/archive/master/sgarest-daemon-master.tar.gz | tar xzf - -C sgarest-daemon --strip-components 1
- cd sgarest-daemon
- export errors=$(luac5.3 -p sgad | find . -regex ".*\.lua" | awk '{print "luac5.3 -p "$1}' | sh -)
- ([ -z "$errors" ] && exit 0 || exit 1)
only:
- master
- tags
FROM ubuntu:16.04
FROM repo.tecgraf.puc-rio.br:18089/soma/ubuntu:16.04-sga-posix
ENV LUA_VERSION 5.3.3
ENV LUAROCKS_VERSION 2.4.2
RUN apt-get update && apt-get install -y \
bc \
curl \
g++ \
gcc \
git \
ksh \
liblua5.3-dev \
libssh-dev \
lua5.3 \
make \
perl \
unzip
RUN ln -s /usr/bin/lua5.3 /usr/bin/lua && \
ln -s /usr/bin/luac5.3 /usr/bin/luac
# RUN curl -L http://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz | tar xzf - && \
# cd /lua-$LUA_VERSION && \
# make linux test && \
......
FROM ubuntu:16.04
ENV LUA_VERSION 5.3.3
ENV LUAROCKS_VERSION 2.4.2
RUN apt-get update && apt-get install -y \
bc \
curl \
g++ \
gcc \
git \
ksh \
liblua5.3-dev \
libssh-dev \
lua5.3 \
make \
perl \
unzip
RUN ln -s /usr/bin/lua5.3 /usr/bin/lua && \
ln -s /usr/bin/luac5.3 /usr/bin/luac
\ No newline at end of file
......@@ -207,6 +207,21 @@ Unpack the [LuaRock dependencies](http://www.tecgraf.puc-rio.br/ftp_pub/csbase/s
Follow instructions on https://github.com/luarocks/luarocks/wiki/LuaRocks-through-a-proxy
## List Version
The version of SGA can be found in *sga-daemon-\*.rockspec* file. The same version is also found in each component: sga-driver-posix, sga-driver-pbs, sga-driver-slurm and sga-exec. One can execute the following command to list the SGA version:
```bash
luarocks list sga-daemon
```
## Release New Version
To release a new sga version run the following script passing as parameter the release version (e.g. 1.6.2) and the next snapshot:
```bash
./release-prepare 1.6.2 1.6.3-SNAPSHOT
```
The command will automatic change the version attribute in *.rockspec files and it will create a new tag with the release version. After that, it will change rockspec files setting the version attribute to the next SNAPSHOT version.
## Docker
### Build
......@@ -245,6 +260,7 @@ csbase/sgarest-daemon
> Arguments `-e SLURM_XXX=XXX` are required only for [sga-driver-slurm](#sga-driver-slurm).
## Credits
This next-generation SGA was designed and implemented at LabLua, PUC-Rio by
......
variables:
DOCKER_HOST: tcp://localhost:2375
DOCKER_DRIVER: overlay2
.docker_deploy:
stage: deploy
image: docker:19.03.4
services:
- name: docker:18-dind
command: [ "--insecure-registry=repo.tecgraf.puc-rio.br:18089" ]
script:
- source shared-vars.sh
- export DOCKER_REGISTRY=${CI_REGISTRY_URL:+$CI_REGISTRY_URL/}
- export DOCKER_REGISTRY_IMAGE_DIND="${CI_REGISTRY_IMAGE}-dind"
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY_URL"
- docker pull $DOCKER_REGISTRY$CI_REGISTRY_IMAGE:$LAST || true
- docker pull $DOCKER_REGISTRY$DOCKER_REGISTRY_IMAGE_DIND:$LAST || true
- cd Docker/posix/
- |
docker build --cache-from $DOCKER_REGISTRY$CI_REGISTRY_IMAGE:$LAST \
--tag $DOCKER_REGISTRY$CI_REGISTRY_IMAGE:$VERSION \
--tag $DOCKER_REGISTRY$CI_REGISTRY_IMAGE:$LAST \
--tag $DOCKER_REGISTRY$CI_REGISTRY_IMAGE:latest .
- sed -r "s%^FROM .*%FROM $DOCKER_REGISTRY$CI_REGISTRY_IMAGE:$VERSION%" Dockerfile_sgadocker > /tmp/sgadind
- |
docker build --cache-from $DOCKER_REGISTRY$DOCKER_REGISTRY_IMAGE_DIND:$LAST \
--tag $DOCKER_REGISTRY$DOCKER_REGISTRY_IMAGE_DIND:$VERSION \
--tag $DOCKER_REGISTRY$DOCKER_REGISTRY_IMAGE_DIND:$LAST \
--tag $DOCKER_REGISTRY$DOCKER_REGISTRY_IMAGE_DIND:latest -f /tmp/sgadind .
- rm -f /tmp/sgadind
- docker push $DOCKER_REGISTRY$CI_REGISTRY_IMAGE:$VERSION
- docker push $DOCKER_REGISTRY$CI_REGISTRY_IMAGE:$LAST
- docker push $DOCKER_REGISTRY$CI_REGISTRY_IMAGE:latest
- docker push $DOCKER_REGISTRY$DOCKER_REGISTRY_IMAGE_DIND:$VERSION
- docker push $DOCKER_REGISTRY$DOCKER_REGISTRY_IMAGE_DIND:$LAST
- docker push $DOCKER_REGISTRY$DOCKER_REGISTRY_IMAGE_DIND:latest
docker_snapshot:
extends: .docker_deploy
before_script:
- export LAST="snapshot"
only:
- master
docker_release:
extends: .docker_deploy
before_script:
- export LAST="stable"
when: manual
only:
- tags
#!/bin/bash
set -e
###############################################################################
# Script para lançamento de versão com criação de tag no repositório e
# preparação para a nova versão snapshot.
# Uso: ./release-prepare-npm.sh VERSION_TO_RELEASE NEXT_SNAPSHOT_VERSION
###############################################################################
if [ "$#" != 2 ]
then
echo "Uso: $0 <VERSION_TO_RELEASE> <NEXT_SNAPSHOT_VERSION>"
exit
fi
RELEASE=$1
SNAPSHOT=$2
checkIsMaster()
{
res=$(git rev-parse --abbrev-ref HEAD)
echo "RES: $res"
[ ! "$res" == "master" ] && { echo "[Error] Tag can only be generated from master!"; exit -1; }
}
changeVersion()
{
fileName=$1
version=$2
sed -i -E "s/^version[[:space:]]*=[[:space:]]*.*$/version = \"$version\"/" $fileName
}
changeRockSpecs()
{
version=$1
echo "Setting version $version..."
changeVersion "sga-daemon-*.rockspec" $version
changeVersion "sga-driver-posix-*.rockspec" $version
changeVersion "sga-driver-pbs-*.rockspec" $version
changeVersion "sga-driver-slurm-*.rockspec" $version
changeVersion "sga-exec-*.rockspec" $version
}
renameRockSpecs()
{
version=$1
echo "Rename files to version $version..."
mv sga-daemon-*.rockspec sga-daemon-$version.rockspec
mv sga-driver-posix-*.rockspec sga-driver-posix-$version.rockspec
mv sga-driver-pbs-*.rockspec sga-driver-pbs-$version.rockspec
mv sga-driver-slurm-*.rockspec sga-driver-slurm-$version.rockspec
mv sga-exec-*.rockspec sga-exec-$version.rockspec
}
stageRockSpecs()
{
# Acrescenta os removidos
git st | grep "deleted" | awk '{print "git add "$2}' | sh -
# Acrescenta os novos
git add *.rockspec
}
releaseVersion()
{
echo "[..] release version $RELEASE..."
changeRockSpecs $RELEASE
renameRockSpecs $RELEASE
stageRockSpecs
git commit -m "[sgarest-daemon release] prepare release $RELEASE" && \
git tag -a $RELEASE -m "Release version $RELEASE." && \
git push --follow-tags && \
echo "[ok]"
}
nextSnapshotVersion()
{
echo "[..] prepare for next development $SNAPSHOT..."
changeRockSpecs $SNAPSHOT
renameRockSpecs $SNAPSHOT
stageRockSpecs
git commit -m "[sgarest-daemon release] prepare for next development $SNAPSHOT" && \
git push && \
echo "[ok]"
}
#checkIsMaster
releaseVersion
nextSnapshotVersion
echo "Success".
exit 0;
package = "sga-daemon"
version = "scm-1"
version = "1.6.2-SNAPSHOT"
source = {
-- url = "git://git.tecgraf.puc-rio.br/csbase-dev/sgarest-daemon.git",
......
package = "sga-driver-pbs"
version = "scm-1"
version = "1.6.2-SNAPSHOT"
source = {
-- url = "git://git.tecgraf.puc-rio.br/csbase-dev/sgarest-daemon.git",
......
package = "sga-driver-posix"
version = "scm-1"
version = "1.6.2-SNAPSHOT"
source = {
-- url = "git://git.tecgraf.puc-rio.br/csbase-dev/sgarest-daemon.git",
......
package = "sga-driver-slurm"
version = "scm-1"
version = "1.6.2-SNAPSHOT"
source = {
-- url = "git://git.tecgraf.puc-rio.br/csbase-dev/sgarest-daemon.git",
......
package = "sga-exec"
version = "scm-1"
version = "1.6.2-SNAPSHOT"
source = {
-- url = "git://git.tecgraf.puc-rio.br/csbase-dev/sgarest-daemon.git",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment