summaryrefslogtreecommitdiff
path: root/azure/stage3-upgrade.yml
blob: 42fc24c1982126351192c1afd0e69667a94c84a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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
138
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
parameters:
  VERSION: ''
  FROM: ''
  FROMVERSION: ''
  TO: ''
  TOVERSION: ''
  REPO: ''
  REPO_PARAMS: ''

jobs:

- job: Upgrade_${{ parameters.FROM }}_${{ parameters.FROMVERSION }}_to_${{ parameters.TO }}_${{ parameters.TOVERSION }}
  timeoutInMinutes: 280
  condition: succeededOrFailed()
  workspace:
    clean: all
  strategy:
    maxParallel: 1
    matrix:
      # rhel-6:
      #   poolName: 'rhel-6'
      # rhel-7:
      #   poolName: 'rhel-7'
      debian-8:
        poolName: 'debian-8'
      debian-9:
        poolName: 'debian-9'
      ubuntu-1604:
        poolName: 'ubuntu-1604'
      ubuntu-1804:
        poolName: 'ubuntu-1804'
  pool:
    name: $(poolName)

  steps:
  - checkout: none
  - template: prepare-vm-for-installation.yml
  - bash: |
      set -ex
      wget ${{ parameters.REPO }} -O install_mariadb.sh
      chmod +x ./install_mariadb.sh
      sudo ./install_mariadb.sh ${{ parameters.REPO_PARAMS }}
      rm -fv ./install_mariadb.sh
    displayName: "Install ${{ parameters.FROM }}-${{ parameters.FROMVERSION }} repo file and key"

  - bash: |
      set -ex
      sudo yum -y install MariaDB-*
      # we must remove cassandra and tokudb (doesn't exist in ES)
      sudo yum -y erase MariaDB-cassandra-engine MariaDB-tokudb-engine ||:
    displayName: "Install ${{ parameters.FROM }}-${{ parameters.FROMVERSION }} on RHEL/Centos"
    condition: in(variables['poolName'], 'rhel-6', 'rhel-7')

  - bash: |
      set -ex
      sudo apt-get update
      export DEBIAN_FRONTEND=noninteractive
      mVersion=${{ parameters.VERSION }}
      if [[ ${mVersion} == '10.2' ]]; then
        BACKUP_PKG=mariadb-backup-${mVersion}
      else
        BACKUP_PKG=mariadb-backup
      fi
      sudo apt-get -y install mariadb-server ${BACKUP_PKG} \
      mariadb-plugin-mroonga mariadb-plugin-oqgraph mariadb-plugin-rocksdb mariadb-plugin-spider \
      mariadb-test mariadb-test-data
      # we do not install cassandra and tokudb (doesn't exist in ES)
    displayName: "Install ${{ parameters.FROM }}-${{ parameters.FROMVERSION }} on Debian/Ubuntu"
    condition: in(variables['poolName'], 'debian-8', 'debian-9', 'debian-10', 'ubuntu-1604', 'ubuntu-1804')

  - bash: |
      set -ex
      if [[ -f /etc/init.d/mysql ]]; then
        restart_cmd="service mysql restart"
      else
        restart_cmd="systemctl restart mysql"
      fi
      sudo ${restart_cmd}
    displayName: "Restart ${{ parameters.FROM }}-${{ parameters.FROMVERSION }}"

  - bash: |
      set -ex
      sudo mysql -e 'SELECT 1'
    displayName: "Check ${{ parameters.FROM }}-${{ parameters.FROMVERSION }} installation on RHEL/Centos"
    condition: in(variables['poolName'], 'rhel-6', 'rhel-7')

  - bash: |
      set -ex
      sudo mysql -p$(MYSQL_PASSWORD) -e 'SELECT 1'
    displayName: "Check ${{ parameters.FROM }}-${{ parameters.FROMVERSION }} installation on Debian/Ubuntu"
    condition: in(variables['poolName'], 'debian-8', 'debian-9', 'ubuntu-1604', 'ubuntu-1804')

  - task: DownloadBuildArtifacts@0
    inputs:
      buildType: 'current'
      specificBuildWithTriggering: true
      downloadType: 'single'
      artifactName: '$(poolName)-RPMS'
      downloadPath: '$(System.ArtifactsDirectory)/current'
    condition: in(variables['poolName'], 'rhel-6', 'rhel-7')

  - task: DownloadBuildArtifacts@0
    inputs:
      buildType: 'current'
      specificBuildWithTriggering: true
      downloadType: 'single'
      artifactName: '$(poolName)-DEBS'
      downloadPath: '$(System.ArtifactsDirectory)/current'
    condition: in(variables['poolName'], 'debian-8', 'debian-9', 'ubuntu-1604', 'ubuntu-1804')

  - bash: |
      set -x
      ls -la '$(System.ArtifactsDirectory)'
      sudo yum -y --nogpgcheck install '$(System.ArtifactsDirectory)'/current/'$(poolName)'-RPMS/*.rpm
    displayName: "Install built RPM packages on RHEL/Centos"
    condition: in(variables['poolName'], 'rhel-6', 'rhel-7')

  - bash: |
      set -xe
      ls -la '$(System.ArtifactsDirectory)'
      sudo sh -c "echo 'deb [trusted=yes] file://$(System.ArtifactsDirectory)/current/$(poolName)-DEBS binary/' > ${DEB_LOCAL_LIST}"
      sudo apt update
      export DEBIAN_FRONTEND=noninteractive
      mVersion=${{ parameters.VERSION }}
      if [[ ${mVersion} == '10.2' ]]; then
        BACKUP_PKG=mariadb-backup-${mVersion}
      else
        BACKUP_PKG=mariadb-backup
      fi
      sudo apt-get --allow-unauthenticated -y -f install \
        mariadb-server mariadb-test ${BACKUP_PKG} mariadb-plugin-connect \
        mariadb-plugin-cracklib-password-check mariadb-plugin-gssapi-client \
        mariadb-plugin-gssapi-server mariadb-plugin-mroonga mariadb-plugin-oqgraph \
        mariadb-plugin-rocksdb mariadb-plugin-spider
      dpkg -l | grep -iE "galera|maria"
    displayName: "Install built DEB packages on Debian/Ubuntu"
    condition: in(variables['poolName'], 'debian-8', 'debian-9', 'ubuntu-1604', 'ubuntu-1804')

  - bash: |
      set -ex
      if [[ -f /etc/init.d/mysql ]]; then
        restart_cmd="service mysql restart"
      else
        restart_cmd="systemctl restart mysql"
      fi
      sudo ${restart_cmd}
    displayName: "Restart built ES Server"

  - bash: |
      set -ex
      sudo mysql -e 'SELECT 1'
    displayName: "Check ES installation on RHEL"
    condition: and(succeeded(), in(variables['poolName'], 'rhel-6', 'rhel-7'))

  - bash: |
      set -ex
      sudo mysql -p$(MYSQL_PASSWORD) -e 'SELECT 1'
    displayName: "Check ES installation on Debian/Ubuntu"
    condition: and(succeeded(), in(variables['poolName'], 'debian-8', 'debian-9', 'ubuntu-1604', 'ubuntu-1804'))