|
| 1 | +# /********************************************************************** |
| 2 | +# * Copyright (C) 2025 Red Hat, Inc. |
| 3 | +# * |
| 4 | +# * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# * you may not use this file except in compliance with the License. |
| 6 | +# * You may obtain a copy of the License at |
| 7 | +# * |
| 8 | +# * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# * |
| 10 | +# * Unless required by applicable law or agreed to in writing, software |
| 11 | +# * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# * See the License for the specific language governing permissions and |
| 14 | +# * limitations under the License. |
| 15 | +# * |
| 16 | +# * SPDX-License-Identifier: Apache-2.0 |
| 17 | +# ***********************************************************************/ |
| 18 | + |
| 19 | +name: "Install Podman 5.x" |
| 20 | +description: "Installs/updates Podman to v5 from the Kubic repository on Ubuntu." |
| 21 | + |
| 22 | +inputs: |
| 23 | + ubuntu-version: |
| 24 | + description: "The Ubuntu version codename for the Kubic repository." |
| 25 | + required: false |
| 26 | + default: "23.10" |
| 27 | + |
| 28 | +runs: |
| 29 | + using: "composite" |
| 30 | + steps: |
| 31 | + - name: Update podman to 5.x |
| 32 | + if: runner.os == 'Linux' |
| 33 | + shell: bash |
| 34 | + run: | |
| 35 | + ubuntu_version='${{ inputs.ubuntu-version }}' |
| 36 | + echo "INFO: Using Ubuntu version '${ubuntu_version}' for Kubic repository." |
| 37 | +
|
| 38 | + echo "INFO: Adding Kubic repository..." |
| 39 | + sudo sh -c "echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list" |
| 40 | + curl -fsSL "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/kubic.gpg |
| 41 | +
|
| 42 | + echo "INFO: Updating package list..." |
| 43 | + sudo apt-get update -qq |
| 44 | +
|
| 45 | + echo "INFO: Installing CRIU dependencies..." |
| 46 | + sudo apt-get install --allow-unauthenticated -qq -y libprotobuf32t64 python3-protobuf libnet1 |
| 47 | +
|
| 48 | + echo "INFO: Installing CRIU manually..." |
| 49 | + curl -sLO http://archive.ubuntu.com/ubuntu/pool/universe/c/criu/criu_3.16.1-2_amd64.deb && sudo dpkg -i criu_3.16.1-2_amd64.deb |
| 50 | +
|
| 51 | + echo "INFO: Installing Podman..." |
| 52 | + sudo apt-get -qq -y install --allow-unauthenticated podman || { |
| 53 | + echo "WARN: Primary installation failed. Trying fallback repository..." |
| 54 | + sudo sh -c "echo 'deb http://ftp.lysator.liu.se/pub/opensuse/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list" |
| 55 | + curl -fsSL "http://ftp.lysator.liu.se/pub/opensuse/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/kubic-fallback.gpg |
| 56 | + sudo apt-get --allow-insecure-repositories update -qq |
| 57 | + sudo apt-get --allow-unauthenticated -y install podman |
| 58 | + } |
| 59 | +
|
| 60 | + echo "INFO: Podman installation complete." |
| 61 | + podman version |
| 62 | +
|
| 63 | + - name: Install Podman on Windows |
| 64 | + if: runner.os == 'Windows' |
| 65 | + shell: pwsh |
| 66 | + run: | |
| 67 | + echo "Installing Podman..." |
| 68 | + curl --output podman-setup.exe -L https://github.com/containers/podman/releases/download/v5.3.2/podman-5.3.2-setup.exe |
| 69 | + # Start the installer and wait for it to complete |
| 70 | + Start-Process -FilePath .\podman-setup.exe -ArgumentList "/install", "/passive", "/norestart", "/log podman-logs.txt" -Wait |
| 71 | + # Check the logs for debugging purposes |
| 72 | + Get-Content podman-logs.txt |
| 73 | +
|
| 74 | + - name: Initialize Podman Machine on Windows |
| 75 | + if: runner.os == 'Windows' |
| 76 | + shell: pwsh |
| 77 | + run: | |
| 78 | + echo "Adding Podman to PATH for this session..." |
| 79 | + $env:PATH += ";C:\Program Files\RedHat\Podman" |
| 80 | + podman --version |
| 81 | + echo "Initializing Podman machine..." |
| 82 | + podman machine init --now |
0 commit comments