Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMM-12359 podman way upgrade #665

Merged
merged 5 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/pmm-upgrade-ui-tests-matrix-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
fail-fast: false
matrix:
old_version: ${{ fromJSON(needs.get_versions.outputs.version_matrix) }}
upgrade_type: ["UI way", "Docker way"]
upgrade_type: ["UI way", "Docker way", "Podman way"]
with:
pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }}
pre_upgrade_tests: '@config-pre-upgrade'
Expand All @@ -63,7 +63,7 @@ jobs:
fail-fast: false
matrix:
old_version: ${{ fromJSON(needs.get_versions.outputs.version_matrix) }}
upgrade_type: ["UI way", "Docker way"]
upgrade_type: ["UI way", "Docker way", "Podman way"]
with:
pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }}
pre_upgrade_tests: '@rbac-pre-upgrade'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pmm-upgrade-ui-tests-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:
options:
- UI way
- Docker way
- Podman way
repository:
description: 'Upgrade to:'
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pmm-upgrade-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:
options:
- UI way
- Docker way
- Side container
- Podman way
repository:
description: 'Upgrade to:'
required: true
Expand Down
114 changes: 114 additions & 0 deletions .github/workflows/upgrade-tests-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,93 @@ jobs:
ref: ${{ inputs.pmm_qa_branch }}
path: ./pmm-qa

- name: 'Install Podman'
if: ${{ inputs.upgrade_type == 'Podman way' }}
working-directory: ./pmm-ui-tests
run: |
. /etc/os-release
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee \
/etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add -
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install -y podman
sudo sysctl net.ipv4.ip_unprivileged_port_start=80

- name: 'Setup Podman <PMM Sever>: "${{ steps.pmm_server_start_image.outputs.result }}"'
if: ${{ inputs.upgrade_type == 'Podman way' }}
working-directory: ./pmm-ui-tests
run: |
### create service files
mkdir -p ~/.config/systemd/user/
cat > ~/.config/systemd/user/pmm-server.service <<EOF
[Unit]
Description=pmm-server
Wants=network-online.target
After=network-online.target
After=nss-user-lookup.target nss-lookup.target
After=time-sync.target

[Service]
Type=simple

# set environment for this unit
Environment=PMM_HTTP_PORT=80
Environment=PMM_PUBLIC_PORT=443
Environment=PMM_VOLUME_NAME=%N
Environment=PMM_SERVER_IMAGE=docker.io/${{ steps.pmm_server_start_image.outputs.result }}
Environment=PMM_ENV_FILE=%h/.config/pmm-server/pmm-server.env

# optional env file that could override previous env settings for this unit
EnvironmentFile=-%h/.config/pmm-server/env

ExecStart=/usr/bin/podman run --rm --replace=true --name=%N -p \${PMM_PUBLIC_PORT}:443/tcp -p \${PMM_HTTP_PORT}:80/tcp --ulimit=host --volume=\${PMM_VOLUME_NAME}:/srv --env-file=\${PMM_ENV_FILE} --health-cmd=none --health-interval=disable \${PMM_SERVER_IMAGE}
ExecStop=/usr/bin/podman stop -t 10 %N
Restart=on-failure
RestartSec=20

[Install]
Alias=%N
WantedBy=default.target

EOF
mkdir -p ~/.config/pmm-server/
cat > ~/.config/pmm-server/pmm-server.env <<EOF
DISABLE_UPDATES=1
#ENABLE_DBAAS=1
PMM_DEBUG=1
PERCONA_TEST_SAAS_HOST=check-dev.percona.com:443
PERCONA_TEST_CHECKS_PUBLIC_KEY=RWTg+ZmCCjt7O8eWeAmTLAqW+1ozUbpRSKSwNTmO+exlS5KEIPYWuYdX
PERCONA_TEST_PLATFORM_ADDRESS=https://check-dev.percona.com:443
PERCONA_TEST_PLATFORM_PUBLIC_KEY=RWTg+ZmCCjt7O8eWeAmTLAqW+1ozUbpRSKSwNTmO+exlS5KEIPYWuYdX
PERCONA_TEST_VERSION_SERVICE_URL=https://check-dev.percona.com/versions/v1
PERCONA_TEST_TELEMETRY_INTERVAL=10s
PERCONA_TEST_TELEMETRY_RETRY_BACKOFF=10s
ENABLE_RBAC=1
EOF

### run service
systemctl --user enable --now pmm-server

### wait for service to be ready
export CONTAINER_NAME="pmm-server"
export LOGS="pmm-managed entered RUNNING state"
attempt=0
while [ $attempt -le 3 ]; do
attempt=$(( $attempt + 1 ))
echo "Waiting for ${CONTAINER_NAME} to be up (attempt: $attempt)..."
result=$(systemctl --user status ${CONTAINER_NAME})
if grep "${LOGS}" <<< $result ; then
echo "${CONTAINER_NAME} is ready!"
break
fi
sleep 10
done;
timeout 100 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://admin:[email protected]/ping)" != "200" ]]; do sleep 5; done' || false
podman exec pmm-server change-admin-password ${{ env.ADMIN_PASSWORD }}

- name: 'Setup <PMM Sever>: "${{ steps.pmm_server_start_image.outputs.result }}"'
if: ${{ inputs.upgrade_type != 'Podman way' }}
working-directory: pmm-qa/pmm-integration
run: |
npm install
Expand Down Expand Up @@ -287,6 +373,34 @@ jobs:
${{ steps.pmm_server_to_image.outputs.IMAGE }}
sleep 30

- name: 'Upgrade pmm-server: <Podman way>'
if: ${{ inputs.upgrade_type == 'Podman way' }}
working-directory: ./pmm-ui-tests
run: |
echo "Upgrading to ${{ steps.pmm_server_to_image.outputs.IMAGE }}"
mkdir -p ~/.config/pmm-server/
echo "PMM_SERVER_IMAGE=docker.io/${{ steps.pmm_server_to_image.outputs.IMAGE }}" > ~/.config/pmm-server/env
source ~/.config/pmm-server/env
podman pull ${{ steps.pmm_server_to_image.outputs.IMAGE }}
systemctl --user restart pmm-server

# sleep 30
### wait for service to be ready
export CONTAINER_NAME="pmm-server"
export LOGS="pmm-managed entered RUNNING state"
attempt=0
while [ $attempt -le 3 ]; do
attempt=$(( $attempt + 1 ))
echo "Waiting for ${CONTAINER_NAME} to be up (attempt: $attempt)..."
result=$(systemctl --user status ${CONTAINER_NAME})
if grep "${LOGS}" <<< $result ; then
echo "${CONTAINER_NAME} is ready!"
break
fi
sleep 10
done;
timeout 100 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://admin:[email protected]/ping)" != "200" ]]; do sleep 5; done' || false

- name: 'Tests <before PMM Client> upgrade'
working-directory: ./pmm-ui-tests/playwright-tests
run: |
Expand Down