diff --git a/misc/ReleaseProcess.md b/misc/ReleaseProcess.md deleted file mode 100644 index 1fa620bf5d..0000000000 --- a/misc/ReleaseProcess.md +++ /dev/null @@ -1,139 +0,0 @@ -## Test - -* Make sure tests pass on Travis (https://travis-ci.org/keycloak/keycloak) -* Make sure tests pass on Jenkins (https://jenkins.mw.lab.eng.bos.redhat.com/hudson/view/Keycloak/job/keycloak_all/) -* Go through the (manual testing)[https://docs.google.com/spreadsheets/d/17C_WEHNE03r5DxN71OXGJaytjA6_WjZKCXRcsnmNQD4] - - -## Release - -### Clone from GitHub - - # git clone https://github.com/keycloak/keycloak.git - # cd keycloak - -### Prepare the release - - # mvn -Pjboss-release release:prepare - -### Perform the release - - # mvn -Pjboss-release release:perform - -### Deploy to Nexus - -Then login to Nexus and release the maven uploads in the staging area. Artifacts will eventually be synced to Maven Central, but this can take up to 24 hours. - -### Upload - -Upload all artifacts to downloads.jboss.org (see https://mojo.redhat.com/docs/DOC-81955 for more details): - - # rsync -rv --protocol=28 distribution/downloads/target/$VERSION keycloak@filemgmt.jboss.org:/downloads_htdocs/keycloak - -### Upload documentation - - # git clone https://github.com/keycloak/keycloak.github.io.git - # cd keycloak.github.io - # rm -rf docs - # unzip ../distribution/downloads/target/$VERSION/keycloak-docs-$VERSION.zip - # mv keycloak-docs-$VERSION docs - # git commit -m "Updated docs to $VERSION" - # git tag $VERSION - # git push --tags - -## After Release - -### Update Bower - - # git clone https://github.com/keycloak/keycloak-js-bower - # cd keycloak-js-bower - # unzip ../distribution/downloads/target/$VERSION/adapters/keycloak-js-adapter-dist-$VERSION.zip - # mv keycloak-js-adapter-dist-$VERSION/*.js dist/keycloak-js-bower - # rmdir keycloak-js-adapter-dist-$VERSION - -Edit bower.json and set version (include -beta -rc, but not -final). Then commit create tag: - - # git commit -m "Updated to $VERSION" - # git tag $VERSION - # git push --tags - -### Update Website - -* Edit [Docs page](https://www.jboss.org/author/keycloak/docs.html) and update version -* Edit [Downloads page](https://www.jboss.org/author/keycloak/downloads) edit directory listing component and update version in title and project root - -### Announce release - -Write a blog post on blog.keycloak.org, blurb about what's new and include links to website for download and jira for changes. - -Copy blog post and send to keycloak-dev and keycloak-users mailing lists. - -Post link to blog post on Twitter (with Keycloak user). - -### Update OpenShift Cartridge - -The OpenShift Cartridge has a base branch that is based on the WildFly cartridge and includes any changes related to Keycloak, but does not include Keycloak -itself. Any configuration changes or upgrading WildFly should be done in the base branch. - -To include changes from the WildFly cartridge, for example when upgrading to a new WildFly version the base branch should be rebased on from the [wildfly-cartridge](https://github.com/openshift-cartridges/openshift-wildfly-cartridge): - - # git clone https://github.com/keycloak/openshift-keycloak-cartridge.git - # cd openshift-keycloak-cartridge - # git remote add wildfly https://github.com/openshift-cartridges/openshift-wildfly-cartridge.git - # git fetch wildfly - # git checkout base - # git rebase wildfly - # git push orgin base:base - -To upgrade Keycloak on the cartridge run: - - # git clone https://github.com/openshift-cartridges/openshift-wildfly-cartridge.git - # cd openshift-keycloak-cartridge - -To remove the previous release of Keycloak on master run: - - # git reset --hard upstream/base - -Once you've done that install the Keycloak overlay: - - # cd versions/9 - # unzip keycloak-overlay-$VERSION.zip - # git commit -m "Install Keycloak $VERSION" -a - # git tag $VERSION - # git push --tags master - -### Update Docker image - - # git clone https://github.com/jboss-dockerfiles/keycloak.git - # cd keycloak - -Edit server/Dockerfile and update version in `ENV KEYCLOAK_VERSION ...` line. - -Edit the following files: - -* server-postgres/Dockerfile -* adapter-wildfly/Dockerfile -* server-ha-postgres/Dockerfile -* server/Dockerfile -* server-mongo/Dockerfile -* examples/Dockerfile -* server-mysql/Dockerfile - -And update version in `FROM jboss/keycloak:...` line. - - # git commit -m "Updated to $VERSION" -a - # git tag $VERSION - # git push --tags master - -Go to Docker Hub. Update build settings for the following images and change `Name` and `Docker Tag Name` to the version you are releasing: - -* [keycloak](https://hub.docker.com/r/jboss/keycloak/~/settings/automated-builds/) -* [adapter-wildfly](https://hub.docker.com/r/jboss/keycloak-adapter-wildfly/~/settings/automated-builds/) -* [examples](https://hub.docker.com/r/jboss/keycloak-examples/~/settings/automated-builds/) -* [postgres](https://hub.docker.com/r/jboss/keycloak-postgres/~/settings/automated-builds/) -* [mysql](https://hub.docker.com/r/jboss/keycloak-mysql/~/settings/automated-builds/) -* [mongo](https://hub.docker.com/r/jboss/keycloak-mongo/~/settings/automated-builds/) -* [ha-postgres](https://hub.docker.com/r/jboss/keycloak-ha-postgres/~/settings/automated-builds/) - -Once you've updated all images. Schedule a build of the [keycloak image](https://hub.docker.com/r/jboss/keycloak/builds/). Once completed it will trigger -builds of all other images as they are linked. \ No newline at end of file diff --git a/server-spi/src/main/java/org/keycloak/migration/migrators/MigrateTo2_0_0.java b/server-spi/src/main/java/org/keycloak/migration/migrators/MigrateTo2_0_0.java index 2b3898c003..23368f3130 100644 --- a/server-spi/src/main/java/org/keycloak/migration/migrators/MigrateTo2_0_0.java +++ b/server-spi/src/main/java/org/keycloak/migration/migrators/MigrateTo2_0_0.java @@ -17,14 +17,10 @@ package org.keycloak.migration.migrators; -import org.keycloak.Config; import org.keycloak.migration.ModelVersion; import org.keycloak.models.AdminRoles; -import org.keycloak.models.ClientModel; -import org.keycloak.models.Constants; import org.keycloak.models.KeycloakSession; import org.keycloak.models.RealmModel; -import org.keycloak.models.RoleModel; import org.keycloak.models.utils.KeycloakModelUtils; public class MigrateTo2_0_0 { @@ -40,27 +36,8 @@ public class MigrateTo2_0_0 { private void migrateAuthorizationServices(RealmModel realm) { KeycloakModelUtils.setupAuthorizationServices(realm); - ClientModel client = realm.getMasterAdminClient(); - - if (client.getRole(AdminRoles.MANAGE_AUTHORIZATION) == null) { - RoleModel role = client.addRole(AdminRoles.MANAGE_AUTHORIZATION); - role.setDescription("${role_" + AdminRoles.MANAGE_AUTHORIZATION + "}"); - role.setScopeParamRequired(false); - - client.getRealm().getRole(AdminRoles.ADMIN).addCompositeRole(role); - } - - if (!realm.getName().equals(Config.getAdminRealm())) { - client = realm.getClientByClientId(Constants.REALM_MANAGEMENT_CLIENT_ID); - - if (client.getRole(AdminRoles.MANAGE_AUTHORIZATION) == null) { - RoleModel role = client.addRole(AdminRoles.MANAGE_AUTHORIZATION); - role.setDescription("${role_" + AdminRoles.MANAGE_AUTHORIZATION + "}"); - role.setScopeParamRequired(false); - - client.getRole(AdminRoles.REALM_ADMIN).addCompositeRole(role); - } - } + MigrationUtils.addAdminRole(realm, AdminRoles.VIEW_AUTHORIZATION); + MigrationUtils.addAdminRole(realm, AdminRoles.MANAGE_AUTHORIZATION); } } diff --git a/server-spi/src/main/java/org/keycloak/migration/migrators/MigrationUtils.java b/server-spi/src/main/java/org/keycloak/migration/migrators/MigrationUtils.java new file mode 100644 index 0000000000..91f812e0bc --- /dev/null +++ b/server-spi/src/main/java/org/keycloak/migration/migrators/MigrationUtils.java @@ -0,0 +1,50 @@ +/* + * Copyright 2016 Red Hat, Inc. and/or its affiliates + * and other contributors as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.keycloak.migration.migrators; + +import org.keycloak.Config; +import org.keycloak.models.*; + +/** + * @author Stian Thorgersen + */ +public class MigrationUtils { + + public static void addAdminRole(RealmModel realm, String roleName) { + ClientModel client = realm.getMasterAdminClient(); + if (client.getRole(roleName) == null) { + RoleModel role = client.addRole(roleName); + role.setDescription("${role_" + roleName + "}"); + role.setScopeParamRequired(false); + + client.getRealm().getRole(AdminRoles.ADMIN).addCompositeRole(role); + } + + if (!realm.getName().equals(Config.getAdminRealm())) { + client = realm.getClientByClientId(Constants.REALM_MANAGEMENT_CLIENT_ID); + if (client.getRole(roleName) == null) { + RoleModel role = client.addRole(roleName); + role.setDescription("${role_" + roleName + "}"); + role.setScopeParamRequired(false); + + client.getRole(AdminRoles.REALM_ADMIN).addCompositeRole(role); + } + } + } + +}