You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "t-rana (via GitHub)" <gi...@apache.org> on 2024/02/27 09:15:48 UTC

[PR] OAK-10670: add support for service principal in oak-upgrade [jackrabbit-oak]

t-rana opened a new pull request, #1329:
URL: https://github.com/apache/jackrabbit-oak/pull/1329

   Azure Service Principal Support in oak-segment-azure. Goal is to allow Azure authentication via:
   
   clientId - Id of the Service Principal object / App registered with the Active Directory.
   clientSecret - Application password.
   tenantId - Azure Active Directory Id.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-10670: add support for service principal in oak-upgrade [jackrabbit-oak]

Posted by "smiroslav (via GitHub)" <gi...@apache.org>.
smiroslav commented on PR #1329:
URL: https://github.com/apache/jackrabbit-oak/pull/1329#issuecomment-1970690588

   @t-rana for new files please add license headers
   ```
   
   [INFO] BUILD FAILURE
   
   [INFO] ------------------------------------------------------------------------
   
   [INFO] Total time:  53.227 s (Wall Clock)
   
   [INFO] Finished at: 2024-02-27T09:27:19Z
   
   [INFO] ------------------------------------------------------------------------
   
   [ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.15:check (default) on project oak-upgrade: Too many files with unapproved license: 3 See RAT report in: /home/jenkins/jenkins-agent/workspace/Jackrabbit_oak-trunk-pr_PR-1329/oak-upgrade/target/rat.txt -> [Help 1]
   
   [ERROR] 
   
   [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
   
   [ERROR] Re-run Maven using the -X switch to enable full debug logging.
   
   [ERROR] 
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-10670: add support for service principal in oak-upgrade [jackrabbit-oak]

Posted by "smiroslav (via GitHub)" <gi...@apache.org>.
smiroslav commented on code in PR #1329:
URL: https://github.com/apache/jackrabbit-oak/pull/1329#discussion_r1505962367


##########
oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/cli/container/SegmentAzureServicePrincipalNodeStoreContainer.java:
##########
@@ -0,0 +1,100 @@
+package org.apache.jackrabbit.oak.upgrade.cli.container;
+
+import com.microsoft.azure.storage.blob.CloudBlobDirectory;
+import org.apache.jackrabbit.guava.common.io.Files;
+import org.apache.jackrabbit.oak.segment.SegmentNodeStoreBuilders;
+import org.apache.jackrabbit.oak.segment.azure.AzurePersistence;
+import org.apache.jackrabbit.oak.segment.azure.AzureUtilities;
+import org.apache.jackrabbit.oak.segment.azure.tool.ToolUtils;
+import org.apache.jackrabbit.oak.segment.azure.util.Environment;
+import org.apache.jackrabbit.oak.segment.file.FileStore;
+import org.apache.jackrabbit.oak.segment.file.FileStoreBuilder;
+import org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException;
+import org.apache.jackrabbit.oak.spi.blob.BlobStore;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+import org.apache.jackrabbit.oak.upgrade.cli.node.FileStoreUtils;
+
+import java.io.File;
+import java.io.IOException;
+
+public class SegmentAzureServicePrincipalNodeStoreContainer implements NodeStoreContainer {
+    private static final Environment ENVIRONMENT = new Environment();
+    private static final String CONTAINER_NAME = "oak-migration-test";
+    private static final String DIR = "repository";
+    private static final String AZURE_SEGMENT_STORE_PATH = "https://%s.blob.core.windows.net/%s/%s";
+
+    private final BlobStore blobStore;
+    private FileStore fs;
+    private File tmpDir;
+    private AzurePersistence azurePersistence;
+
+    public SegmentAzureServicePrincipalNodeStoreContainer() {
+        this(null);
+    }
+
+    public SegmentAzureServicePrincipalNodeStoreContainer(BlobStore blobStore) {
+        this.blobStore = blobStore;
+    }
+
+
+    @Override
+    public NodeStore open() throws IOException {
+        try {
+            azurePersistence = createAzurePersistence();
+        } catch (Exception e) {
+            throw new IllegalStateException(e);
+        }
+
+        tmpDir = Files.createTempDir();
+        FileStoreBuilder builder = FileStoreBuilder.fileStoreBuilder(tmpDir)
+                .withCustomPersistence(azurePersistence).withMemoryMapping(false);
+        if (blobStore != null) {
+            builder.withBlobStore(blobStore);
+        }
+
+        try {
+            fs = builder.build();
+        } catch (InvalidFileStoreVersionException e) {
+            throw new IllegalStateException(e);
+        }
+
+        return new FileStoreUtils.NodeStoreWithFileStore(SegmentNodeStoreBuilders.builder(fs).build(), fs);
+    }
+
+    private AzurePersistence createAzurePersistence() {
+        if (azurePersistence != null) {
+            return azurePersistence;
+        }
+        String path = String.format(AZURE_SEGMENT_STORE_PATH, ENVIRONMENT.getVariable(AzureUtilities.AZURE_ACCOUNT_NAME),
+                CONTAINER_NAME, DIR);
+        CloudBlobDirectory cloudBlobDirectory = ToolUtils.createCloudBlobDirectory(path, ENVIRONMENT);
+        return new AzurePersistence(cloudBlobDirectory);
+    }
+
+    @Override
+    public void close() {
+        if (tmpDir != null) {

Review Comment:
   Maybe do this after the file store is closed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-10670: add support for service principal in oak-upgrade [jackrabbit-oak]

Posted by "smiroslav (via GitHub)" <gi...@apache.org>.
smiroslav merged PR #1329:
URL: https://github.com/apache/jackrabbit-oak/pull/1329


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-10670: add support for service principal in oak-upgrade [jackrabbit-oak]

Posted by "t-rana (via GitHub)" <gi...@apache.org>.
t-rana commented on code in PR #1329:
URL: https://github.com/apache/jackrabbit-oak/pull/1329#discussion_r1508497917


##########
oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/cli/container/SegmentAzureServicePrincipalNodeStoreContainer.java:
##########
@@ -0,0 +1,100 @@
+package org.apache.jackrabbit.oak.upgrade.cli.container;
+
+import com.microsoft.azure.storage.blob.CloudBlobDirectory;
+import org.apache.jackrabbit.guava.common.io.Files;
+import org.apache.jackrabbit.oak.segment.SegmentNodeStoreBuilders;
+import org.apache.jackrabbit.oak.segment.azure.AzurePersistence;
+import org.apache.jackrabbit.oak.segment.azure.AzureUtilities;
+import org.apache.jackrabbit.oak.segment.azure.tool.ToolUtils;
+import org.apache.jackrabbit.oak.segment.azure.util.Environment;
+import org.apache.jackrabbit.oak.segment.file.FileStore;
+import org.apache.jackrabbit.oak.segment.file.FileStoreBuilder;
+import org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException;
+import org.apache.jackrabbit.oak.spi.blob.BlobStore;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+import org.apache.jackrabbit.oak.upgrade.cli.node.FileStoreUtils;
+
+import java.io.File;
+import java.io.IOException;
+
+public class SegmentAzureServicePrincipalNodeStoreContainer implements NodeStoreContainer {
+    private static final Environment ENVIRONMENT = new Environment();
+    private static final String CONTAINER_NAME = "oak-migration-test";
+    private static final String DIR = "repository";
+    private static final String AZURE_SEGMENT_STORE_PATH = "https://%s.blob.core.windows.net/%s/%s";
+
+    private final BlobStore blobStore;
+    private FileStore fs;
+    private File tmpDir;
+    private AzurePersistence azurePersistence;
+
+    public SegmentAzureServicePrincipalNodeStoreContainer() {
+        this(null);
+    }
+
+    public SegmentAzureServicePrincipalNodeStoreContainer(BlobStore blobStore) {
+        this.blobStore = blobStore;
+    }
+
+
+    @Override
+    public NodeStore open() throws IOException {
+        try {
+            azurePersistence = createAzurePersistence();
+        } catch (Exception e) {
+            throw new IllegalStateException(e);
+        }
+
+        tmpDir = Files.createTempDir();
+        FileStoreBuilder builder = FileStoreBuilder.fileStoreBuilder(tmpDir)
+                .withCustomPersistence(azurePersistence).withMemoryMapping(false);
+        if (blobStore != null) {
+            builder.withBlobStore(blobStore);
+        }
+
+        try {
+            fs = builder.build();
+        } catch (InvalidFileStoreVersionException e) {
+            throw new IllegalStateException(e);
+        }
+
+        return new FileStoreUtils.NodeStoreWithFileStore(SegmentNodeStoreBuilders.builder(fs).build(), fs);
+    }
+
+    private AzurePersistence createAzurePersistence() {
+        if (azurePersistence != null) {
+            return azurePersistence;
+        }
+        String path = String.format(AZURE_SEGMENT_STORE_PATH, ENVIRONMENT.getVariable(AzureUtilities.AZURE_ACCOUNT_NAME),
+                CONTAINER_NAME, DIR);
+        CloudBlobDirectory cloudBlobDirectory = ToolUtils.createCloudBlobDirectory(path, ENVIRONMENT);
+        return new AzurePersistence(cloudBlobDirectory);
+    }
+
+    @Override
+    public void close() {
+        if (tmpDir != null) {

Review Comment:
   this is done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org