Skip to content

Commit

Permalink
[Ubuntu] don't install mysql server
Browse files Browse the repository at this point in the history
Inside container environment we're not running a second service process,
but use service container for act instead.

See: nektos/act#1949
Signed-off-by: You-Sheng Yang <[email protected]>
  • Loading branch information
vicamo committed Mar 11, 2024
1 parent ed5f6ac commit dce295e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 19 deletions.
24 changes: 13 additions & 11 deletions images/ubuntu/scripts/build/install-mysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,26 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/os.sh

# Mysql setting up root password
MYSQL_ROOT_PASSWORD=root
echo "mysql-server mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | debconf-set-selections
echo "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | debconf-set-selections

export ACCEPT_EULA=Y

# Install MySQL Client
apt-get install mysql-client -y

# Install MySQL Server
apt-get install -y mysql-server

#Install MySQL Dev tools
apt install libmysqlclient-dev -y

# Disable mysql.service
systemctl is-active --quiet mysql.service && systemctl stop mysql.service
systemctl disable mysql.service
if [[ ! -f /run/systemd/container ]]; then
# Mysql setting up root password
MYSQL_ROOT_PASSWORD=root
echo "mysql-server mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | debconf-set-selections
echo "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | debconf-set-selections

# Install MySQL Server
apt-get install -y mysql-server

# Disable mysql.service
systemctl is-active --quiet mysql.service && systemctl stop mysql.service
systemctl disable mysql.service
fi

invoke_tests "Databases" "MySQL"
22 changes: 15 additions & 7 deletions images/ubuntu/scripts/docs-gen/SoftwareReport.Databases.psm1
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"

function Get-PostgreSqlVersion {
$postgreSQLVersion = psql --version | Get-StringPart -Part 2
return $postgreSQLVersion
Expand All @@ -14,7 +16,7 @@ function Get-SqliteVersion {
}

function Get-MySQLVersion {
$mySQLVersion = mysqld --version | Get-StringPart -Part 2
$mySQLVersion = mysql --version | Get-StringPart -Part 2
return $mySQLVersion
}

Expand Down Expand Up @@ -43,12 +45,18 @@ function Build-PostgreSqlSection {
function Build-MySQLSection {
$node = [HeaderNode]::new("MySQL")
$node.AddToolVersion("MySQL", $(Get-MySQLVersion))
$node.AddNote(@(
"User: root",
"Password: root",
"MySQL service is disabled by default.",
"Use the following command as a part of your job to start the service: 'sudo systemctl start mysql.service'"
) -join "`n")
if (Test-IsContainer) {
$node.AddNote(@(
"MySQL service is not installed."
) -join "`n")
} else {
$node.AddNote(@(
"User: root",
"Password: root",
"MySQL service is disabled by default.",
"Use the following command as a part of your job to start the service: 'sudo systemctl start mysql.service'"
) -join "`n")
}

return $node
}
Expand Down
4 changes: 3 additions & 1 deletion images/ubuntu/scripts/tests/Databases.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"

Describe "MongoDB" -Skip:(Test-IsUbuntu22) {
It "<ToolName>" -TestCases @(
@{ ToolName = "mongo" }
Expand Down Expand Up @@ -29,7 +31,7 @@ Describe "MySQL" {
"mysql -V" | Should -ReturnZeroExitCode
}

It "MySQL Service" {
It "MySQL Service" -Skip:(Test-IsContainer) {
"sudo systemctl start mysql" | Should -ReturnZeroExitCode
mysql -s -N -h localhost -uroot -proot -e "select count(*) from mysql.user where user='root' and authentication_string is null;" | Should -BeExactly 0
"sudo mysql -vvv -e 'CREATE DATABASE smoke_test' -uroot -proot" | Should -ReturnZeroExitCode
Expand Down

0 comments on commit dce295e

Please sign in to comment.