Esempio n. 1
0
        void KeyVaultFileUpdating(object sender, CodeCakeBuilderKeyVaultUpdatingArgs e)
        {
            CKSetupStore store = e.SolutionSpec.UseCKSetup
                                    ? e.Solution.ArtifactTargets.OfType <CKSetupStore>().SingleOrDefault()
                                    : null;

            if (store != null && e.Secrets.TryGetValue(store.SecretKeyName, out var apiKey))
            {
                // The actual key contains both the url and the secret.
                e.Secrets["CKSETUP_CAKE_TARGET_STORE_APIKEY_AND_URL"] = apiKey + '|' + store.Url;
                e.Secrets.Remove(store.SecretKeyName);
            }
        }
        void KeyVaultFileUpdating(object sender, CodeCakeBuilderKeyVaultUpdatingArgs e)
        {
            CKSetupStore store = e.SolutionSpec.UseCKSetup
                                    ? e.Solution.ArtifactTargets.OfType <CKSetupStore>().SingleOrDefault()
                                    : null;

            if (store != null)
            {
                if (e.Secrets.TryGetValue(store.SecretKeyName, out var apiKey))
                {
                    // The actual key contains both the url and the secret.
                    e.Secrets["CKSETUP_CAKE_TARGET_STORE_APIKEY_AND_URL"] = apiKey + '|' + store.Url;
                    e.Secrets.Remove(store.SecretKeyName);
                }
                else
                {
                    e.Monitor.Warn($"Missing '{store.SecretKeyName}' secret. Unable to configure 'CKSETUP_CAKE_TARGET_STORE_APIKEY_AND_URL' in 'CodeCakeBuilderKeyVault.txt' file.");
                }
            }
        }