Hard require staging

This removes the logic around supporting opting out of the staging
feature. We don't want to support multiple configurations here, and at
this point, staging should be considered stable.

Closes: #1546
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2018-09-10 00:15:29 -04:00 committed by Atomic Bot
parent 0d2b819e19
commit 807f21788e
15 changed files with 6 additions and 144 deletions

View File

@ -200,14 +200,6 @@ AS_IF([test x$enable_compose_tooling = xyes], [
])
if test x$enable_compose_tooling != xno; then RPM_OSTREE_FEATURES="$RPM_OSTREE_FEATURES compose"; fi
AC_ARG_ENABLE(staged,
AS_HELP_STRING([--disable-staged],
[Disable staged deployments by default]),,
[enable_staged=yes])
AS_IF([test x$enable_staged = xyes], [
AC_DEFINE(BUILDOPT_STAGE_DEPLOYMENTS, 1, [Define if we are staging deployments])
])
AC_PATH_PROG([cargo], [cargo])
AS_IF([test -z "$cargo"], [AC_MSG_ERROR([cargo is required for --enable-rust])])
AC_PATH_PROG([rustc], [rustc])

View File

@ -1206,15 +1206,9 @@ rpmostree_sysroot_upgrader_deploy (RpmOstreeSysrootUpgrader *self,
const char *target_revision = self->final_revision ?: self->base_revision;
g_assert (target_revision);
/* Use staging only if we're booted into the target root. Further,
* it's currently gated behind either the "stage" automatic update
* policy, or an experimental flag that applies globally to all operations.
*/
const gboolean staging_is_configured =
(self->flags & RPMOSTREE_SYSROOT_UPGRADER_FLAGS_STAGE) > 0 ||
rpmostreed_get_ex_stage_deployments (rpmostreed_daemon_get ());
const gboolean use_staging = staging_is_configured &&
ostree_sysroot_get_booted_deployment (self->sysroot) != NULL;
/* Use staging only if we're booted into the target root. */
const gboolean use_staging =
(ostree_sysroot_get_booted_deployment (self->sysroot) != NULL);
/* Fix for https://github.com/projectatomic/rpm-ostree/issues/1392,
* when kargs_strv is empty, we port those directly from pending
@ -1325,9 +1319,6 @@ rpmostree_sysroot_upgrader_flags_get_type (void)
{ RPMOSTREE_SYSROOT_UPGRADER_FLAGS_SYNTHETIC_PULL,
"RPMOSTREE_SYSROOT_UPGRADER_FLAGS_SYNTHETIC_PULL",
"synthetic-pull" },
{ RPMOSTREE_SYSROOT_UPGRADER_FLAGS_STAGE,
"RPMOSTREE_SYSROOT_UPGRADER_FLAGS_STAGE",
"stage" },
};
GType g_define_type_id =
g_flags_register_static (g_intern_static_string ("RpmOstreeSysrootUpgraderFlags"), values);

View File

@ -43,7 +43,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (RpmOstreeSysrootUpgrader, g_object_unref)
* @RPMOSTREE_SYSROOT_UPGRADER_FLAGS_DRY_RUN: Don't deploy new base. If layering packages, only print the transaction
* @RPMOSTREE_SYSROOT_UPGRADER_FLAGS_PKGCACHE_ONLY: Don't try to update cached packages.
* @RPMOSTREE_SYSROOT_UPGRADER_FLAGS_SYNTHETIC_PULL: Don't actually pull, just resolve ref and timestamp check
* @RPMOSTREE_SYSROOT_UPGRADER_FLAGS_STAGE: Temporary flag to use libostree staging
*
* Flags controlling operation of an #RpmOstreeSysrootUpgrader.
*/
@ -55,7 +54,6 @@ typedef enum {
RPMOSTREE_SYSROOT_UPGRADER_FLAGS_DRY_RUN = (1 << 3),
RPMOSTREE_SYSROOT_UPGRADER_FLAGS_PKGCACHE_ONLY = (1 << 4),
RPMOSTREE_SYSROOT_UPGRADER_FLAGS_SYNTHETIC_PULL = (1 << 5),
RPMOSTREE_SYSROOT_UPGRADER_FLAGS_STAGE = (1 << 6), /* temporary */
} RpmOstreeSysrootUpgraderFlags;
/* _NONE means we're doing pure ostree, no client-side computation.

View File

@ -70,7 +70,6 @@ struct _RpmostreedDaemon {
/* Settings from the config file */
guint idle_exit_timeout;
RpmostreedAutomaticUpdatePolicy auto_update_policy;
gboolean ex_stage_deployments;
GDBusConnection *connection;
GDBusObjectManagerServer *object_manager;
@ -381,12 +380,6 @@ rpmostreed_get_automatic_update_policy (RpmostreedDaemon *self)
return self->auto_update_policy;
}
gboolean
rpmostreed_get_ex_stage_deployments (RpmostreedDaemon *self)
{
return self->ex_stage_deployments;
}
/* in-place version of g_ascii_strdown */
static inline void
ascii_strdown_inplace (char *str)
@ -422,19 +415,6 @@ rpmostreed_daemon_reload_config (RpmostreedDaemon *self,
return FALSE;
}
/* The default used to be `false`, so check for the key being present */
if (g_key_file_has_key (config, EXPERIMENTAL_CONFIG_GROUP, "StageDeployments", NULL))
self->ex_stage_deployments = g_key_file_get_boolean (config, EXPERIMENTAL_CONFIG_GROUP,
"StageDeployments", NULL);
else
{
#ifdef BUILDOPT_STAGE_DEPLOYMENTS
self->ex_stage_deployments = TRUE;
#else
self->ex_stage_deployments = FALSE;
#endif
}
/* don't update changed for this; it's contained to RpmostreedDaemon so no other objects
* need to be reloaded if it changes */
self->idle_exit_timeout = idle_exit_timeout;

View File

@ -55,6 +55,3 @@ gboolean rpmostreed_daemon_reload_config (RpmostreedDaemon *self,
RpmostreedAutomaticUpdatePolicy
rpmostreed_get_automatic_update_policy (RpmostreedDaemon *self);
gboolean
rpmostreed_get_ex_stage_deployments (RpmostreedDaemon *self);

View File

@ -597,7 +597,7 @@ os_merge_or_start_deployment_txn (RPMOSTreeOS *interface,
rpmostreed_transaction_monitor_add (self->transaction_monitor, transaction);
/* For the AutomaticUpdateTrigger "check" case, we want to make sure we refresh
* the CachedUpdate property; "ex-stage" will do this through sysroot_changed */
* the CachedUpdate property; "stage" will do this through sysroot_changed */
const char *method_name = g_dbus_method_invocation_get_method_name (invocation);
if (g_str_equal (method_name, "AutomaticUpdateTrigger") &&
(default_flags & (RPMOSTREE_TRANSACTION_DEPLOY_FLAG_DOWNLOAD_ONLY |
@ -786,7 +786,6 @@ os_handle_automatic_update_trigger (RPMOSTreeOS *interface,
dfault = RPMOSTREE_TRANSACTION_DEPLOY_FLAG_DOWNLOAD_METADATA_ONLY;
break;
case RPMOSTREED_AUTOMATIC_UPDATE_POLICY_STAGE:
dfault = RPMOSTREE_TRANSACTION_DEPLOY_FLAG_STAGE;
break;
default:
g_assert_not_reached ();

View File

@ -804,8 +804,6 @@ deploy_transaction_execute (RpmostreedTransaction *transaction,
upgrader_flags |= RPMOSTREE_SYSROOT_UPGRADER_FLAGS_ALLOW_OLDER;
if (dry_run)
upgrader_flags |= RPMOSTREE_SYSROOT_UPGRADER_FLAGS_DRY_RUN;
if (self->flags & RPMOSTREE_TRANSACTION_DEPLOY_FLAG_STAGE)
upgrader_flags |= RPMOSTREE_SYSROOT_UPGRADER_FLAGS_STAGE;
/* DOWNLOAD_METADATA_ONLY isn't directly exposed at the D-Bus API level, so we shouldn't
* ever run into these conflicting options */

View File

@ -55,7 +55,6 @@ typedef enum {
RPMOSTREE_TRANSACTION_DEPLOY_FLAG_DRY_RUN = (1 << 5),
RPMOSTREE_TRANSACTION_DEPLOY_FLAG_DOWNLOAD_ONLY = (1 << 8),
RPMOSTREE_TRANSACTION_DEPLOY_FLAG_DOWNLOAD_METADATA_ONLY = (1 << 9),
RPMOSTREE_TRANSACTION_DEPLOY_FLAG_STAGE = (1 << 10),
} RpmOstreeTransactionDeployFlags;

View File

@ -1028,7 +1028,7 @@ rpmostree_str_to_auto_update_policy (const char *str,
*out_policy = RPMOSTREED_AUTOMATIC_UPDATE_POLICY_NONE;
else if (g_str_equal (str, "check"))
*out_policy = RPMOSTREED_AUTOMATIC_UPDATE_POLICY_CHECK;
else if (g_str_equal (str, "stage") || g_str_equal (str, "ex-stage"))
else if (g_str_equal (str, "stage") || g_str_equal (str, "ex-stage") /* backcompat */)
*out_policy = RPMOSTREED_AUTOMATIC_UPDATE_POLICY_STAGE;
else
return glnx_throw (error, "Invalid value for AutomaticUpdatePolicy: '%s'", str);

View File

@ -42,9 +42,7 @@ vm_rpmostree rebase vmcheckmote:vmcheck \
--install layered-sec-low \
--install layered-sec-crit \
--install layered-constant
if vm_cmd 'grep -qE -e "^StageDeployments=true" /etc/rpm-ostreed.conf'; then
vm_cmd systemctl is-active ostree-finalize-staged.service
fi
vm_cmd systemctl is-active ostree-finalize-staged.service
vm_reboot
vm_rpmostree status -v
vm_assert_status_jq \

View File

@ -24,11 +24,6 @@ set -euo pipefail
set -x
# Uses livefs
vm_cmd 'echo "[Experimental]" >> /etc/rpm-ostreed.conf'
vm_cmd 'echo StageDeployments=true >> /etc/rpm-ostreed.conf'
vm_rpmostree reload
# SUMMARY: check that RPM scripts are properly handled during package layering
# do a bunch of tests together so that we only have to reboot once

View File

@ -28,10 +28,6 @@ set -x
# clean slate.
vm_rpmostree cleanup -pr
vm_cmd 'echo "[Experimental]" >> /etc/rpm-ostreed.conf'
vm_cmd 'echo StageDeployments=true >> /etc/rpm-ostreed.conf'
vm_rpmostree reload
vm_assert_layered_pkg foo absent
vm_build_rpm foo

View File

@ -1,38 +0,0 @@
#!/bin/bash
#
# Copyright (C) 2018 Red Hat
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
set -euo pipefail
dn=$(cd $(dirname $0) && pwd)
. ${commondir}/libtest.sh
. ${commondir}/libvm.sh
set -x
# This test suite enables the libostree staging feature, and executes
# the layering-relayer tests.
export VMCHECK_FLAGS=not-stage-deployments
vm_cmd 'echo "[Experimental]" >> /etc/rpm-ostreed.conf'
vm_cmd 'echo StageDeployments=false >> /etc/rpm-ostreed.conf'
vm_rpmostree reload
${dn}/test-layering-relayer.sh
echo "meta-ok layering-relayer"

View File

@ -1,38 +0,0 @@
#!/bin/bash
#
# Copyright (C) 2018 Red Hat
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
set -euo pipefail
dn=$(cd $(dirname $0) && pwd)
. ${commondir}/libtest.sh
. ${commondir}/libvm.sh
set -x
# This test suite enables the libostree staging feature, and executes
# the upgrade and layering-relayer tests.
export VMCHECK_FLAGS=not-stage-deployments
vm_cmd 'echo "[Experimental]" >> /etc/rpm-ostreed.conf'
vm_cmd 'echo StageDeployments=false >> /etc/rpm-ostreed.conf'
vm_rpmostree reload
${dn}/test-upgrades.sh
echo "meta-ok upgrades"

View File

@ -77,11 +77,6 @@ if vm_cmd test -f /etc/rpm-ostreed.conf; then
fi
if vm_cmd test -f /usr/etc/rpm-ostreed.conf; then
vm_cmd cp -f /usr/etc/rpm-ostreed.conf /etc
# Unless we're doing overrides
if [[ "${VMCHECK_FLAGS:-}" =~ "not-stage-deployments" ]]; then
vm_cmd 'echo "[Experimental]" >> /etc/rpm-ostreed.conf'
vm_cmd 'echo StageDeployments=false >> /etc/rpm-ostreed.conf'
fi
fi
vm_cmd ostree remote delete --if-exists vmcheckmote