templates.yml 5.88 KB
Newer Older
Zakhar Shkonda's avatar
Zakhar Shkonda committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Compile job templates
.compile_job:
  stage: build
  image: # OVERRIDE-IN-CHILD
  tags:
    - osdu-medium
  artifacts:
    name: OpenZGY-$LINUXDISTRO
    expire_in: 1 hr
    paths:
    - build
    exclude:
    - build/**.timestamp
  before_script: 
    - | 
      set -e -x
17
18
19
20
21
22
      # The image we are running in might not have up to date CA certificates,
      # which would cause problems when downloading the software below.
      # Note that this will only work if running as root in a container.
      # In a shared runner we won't be allowed to modufy the system.
      apt-get update
      apt-get install -y ca-certificates || echo "Cert update failed"
Zakhar Shkonda's avatar
Zakhar Shkonda committed
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
      git clone --recursive https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-cpp-lib.git osdu-sdapi-cpp 
      echo "All files in $(pwd)"; ls -FC .. . * || true 

      # Patch version for OpenZGY
      export AZURE_BUILDID="${CI_PIPELINE_IID}"

      # Build SDAPI
      cd osdu-sdapi-cpp
      chmod +x devops/scripts/gen_version.sh
      SDAPI_VERSION=$(devops/scripts/gen_version.sh)
      echo ${SDAPI_VERSION}
      devops/scripts/build-linux64.sh --build-mode=Release \
          --lib-version=${SDAPI_VERSION}  \
          --build-utest  \
          ${CLOUD_PROVIDERS}

      #Pack SDAPI without root directory (required for OpenZGY)
40
      ( cd ./dist/Release/sdapi-${SDAPI_VERSION}; tar -cf - * ) | gzip > ./dist/sdapi_linux64_osdu.tar.gz
41
42
43
44
45
46
47
48
49
      echo "Debugging a build issue: Show contents of $(pwd)"
      ( set +e -x
        ls -FC
        ls -FC dist
        ls -FC dist/Release
        ls -FC dist/Release/sdapi-${SDAPI_VERSION}
        echo "Tarball after stripping two directory levels"
        tar ztvf dist/sdapi_linux64_osdu.tar.gz
      )
50
      #Copy SDAPI to where thge OpenZGY build expects to find it.
Zakhar Shkonda's avatar
Zakhar Shkonda committed
51
      cd ..
52
53
      mkdir -p pkg
      cp ./osdu-sdapi-cpp/dist/sdapi_linux64_osdu.tar.gz  pkg/sdapi_linux64.tar.gz
Zakhar Shkonda's avatar
Zakhar Shkonda committed
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

  script: #Implement 

  after_script: 
    - |
      PROVIDERS=$(echo ${CLOUD_PROVIDERS} | sed 's/--//g' | sed 's/-provider//g' | sed 's/ /./g')
      PKGINFOPATH=$(find ./build/deploy/native -name PKG-INFO) 
      echo $PKGINFOPATH
      OPENZGYVERSION=$(grep '^Version:' $PKGINFOPATH | cut -d ' ' -f 2)
      echo $OPENZGYVERSION
      tar --directory=./build/deploy/ -cf - . | gzip > ./build/OpenZGY.${LINUXDISTRO}.sdms-bundle-${PROVIDERS}.${OPENZGYVERSION}.tar.gz  



.focal_compile_job: 
  extends: .compile_job
  image: community.opengroup.org:5555/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-cpp-lib/sdapi-osdu-ubuntu-static-deps:latest
  artifacts:
    name: OpenZGY-focal
  script: |
    #Install python for OpenZGY
75
    apt-get update
Zakhar Shkonda's avatar
Zakhar Shkonda committed
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
    DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install  \
           python3-dev python3-pip python3-setuptools python3-tk
     pip3 install wheel virtualenv numpy cython
    
    #Build OpenZGY
    make build testscripts


.centos7_compile_job: 
  extends: .compile_job
  image: community.opengroup.org:5555/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-cpp-lib/sdapi-osdu-centos7-static-deps:latest
  artifacts:
    name: OpenZGY-centos7
  script: |  
    #Install componets for OpenZGY build
    yum -y install \
    bzip2 \
    pip3 install wheel virtualenv numpy cython   \
    python2 python3 python3-devel python3-tkinter

    python3.6 -m ensurepip; \
    python3.6 -m pip install --upgrade pip; \
    python3.6 -m pip install wheel virtualenv numpy cython

    /bin/rm -f /usr/bin/pip3; \
    test -r /usr/bin/python3 || ln -s python3.6 /usr/bin/python3; \
    test -r /usr/bin/pip3    || ln -s /usr/local/bin/pip3 /usr/bin/pip3

    #Build OpenZGY
    make build testscripts


# Deploy job templates

.deploy_job: 
  stage: deploy
  image: docker:19.03
  script: |
   set -e -x
   apk add curl
   ls -laR 
   echo "${CI_API_V4_URL}"
   echo "${CI_PROJECT_ID}"
   PKGINFOPATH=$(find ./build/ -name PKG-INFO) 
   OPENZGYVERSION=$(grep '^Version:' $PKGINFOPATH | cut -d ' ' -f 2)
   OPENZGYPATH=$(find "$(pwd -P)" -name OpenZGY.${LINUXDISTRO}*.tar.gz) 
   OPENZGYFILE=$(basename ${OPENZGYPATH}) 
   
   echo ${OPENZGYVERSION}
   echo ${OPENZGYPATH}
   echo ${OPENZGYFILE}
   curl -v --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${OPENZGYPATH} "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/OpenZGY/$OPENZGYVERSION/${OPENZGYFILE}"
 

# Test templates. Can be used if we put tests in a separate job.

.test:
  stage: test
  image: community.opengroup.org:5555/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-cpp-lib/sdapi-osdu-ubuntu-static-deps:latest
  before_script:
  - |
    set -e -x
138
    apt-get update
Zakhar Shkonda's avatar
Zakhar Shkonda committed
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
    DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install  \
          strace valgrind \
          uuid-dev \
          python3-dev python3-pip python3-setuptools python3-tk
    pip3 install wheel virtualenv numpy cython
    ls -laR
    
    python3 -m pip install build/deploy/pure/OpenZGY-*.whl
    python3 -m pip install build/deploy/sdglue/*/SdGlue-*.whl || true
    python3 -m pip install build/deploy/wrapper/*/OpenZgyBindings-*.whl
    du -skc build/deploy/native/* && ls -l build/deploy

    export CLIENT_ID="" 
    export CLIENT_SECRET="" 
    export OPENZGY_SDURL="" 
    export OPENZGY_SDAPIKEY="" 
    export OPENZGY_TOKEN="" 
    export OPENZGY_TESTDATA="../testdata" 
    export OPENZGY_SDTESTDATA="sd://sntc/testdata" 
    export OPENZGY_SDTESTSINK="sd://sntc/testsink/d"



.test-focal:
  extends: .test
  image: community.opengroup.org:5555/osdu/platform/domain-data-mgmt-services/seismic/seismic-dms-suite/seismic-store-cpp-lib/sdapi-osdu-ubuntu-static-deps:latest
  script:
  - |
    echo "RUN native/src/runtests.sh"
    native/src/runtests.sh
    
    echo "RUN wrapper/runtests.sh"
    wrapper/runtests.sh
    
    echo "RUN python/runtests.sh"
    python/runtests.sh 
  dependencies:
  - focal-compile-azure-curl