Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Towards Auto API #336

Merged
merged 15 commits into from
May 22, 2024
Merged

Towards Auto API #336

merged 15 commits into from
May 22, 2024

Conversation

pawelprazak
Copy link
Contributor

@pawelprazak pawelprazak commented Dec 20, 2023

Part of #254

Goal: 90% of MVP

The scope:

  • internal sync implementation with ~90% feature coverage

Out of scope:

  • RemoteWorkspace implementation
  • async implementation
  • inline programs (work in progress, but not complete)
  • missing GetPermalink implementation
  • missing event streams / log file streaming / tailer exposed to the user
  • missing progress / error stream / unix pipe streams exposed to the user
  • using custom execution context for the language server and shell
  • fix serialization issues in yaml and json
  • no logger

API surface missing, notable details:

  /** Allows specifying one or more Writers to redirect incremental preview stdout
    */
  case class ProgressStreams(writers: os.ProcessOutput*) extends PreviewOption

  /** Allows specifying one or more Writers to redirect incremental preview stderr
    */
  case class ErrorProgressStreams(writers: os.ProcessOutput*) extends PreviewOption

  /** Allows specifying one or more channels to receive the Pulumi event stream
    */
  case class EventStreams(channels: EngineEvent*) extends PreviewOption

@pawelprazak pawelprazak added impact/broken Something that is difficult or impossible for some people to use kind/missing We are missing a part of functionality compared to upstream area/automation-api The Automation API labels Dec 20, 2023
@pawelprazak pawelprazak force-pushed the pprazak/towards-auto-api branch 2 times, most recently from b0395f0 to b6cd805 Compare December 21, 2023 09:44
@pawelprazak pawelprazak force-pushed the pprazak/towards-auto-api branch 2 times, most recently from 5233c56 to 9d83209 Compare December 27, 2023 11:20
@pawelprazak pawelprazak changed the title Towards auto api Towards Auto API Dec 27, 2023
@pawelprazak pawelprazak added this to the 0.3.0 milestone Jan 26, 2024
@pawelprazak pawelprazak force-pushed the pprazak/towards-auto-api branch 4 times, most recently from d09c590 to 9d85da6 Compare February 14, 2024 14:32
@pawelprazak pawelprazak modified the milestones: 0.3.0, 1.0.0 Feb 22, 2024
)
)(_ => block).toEither.left.map(AutoError("Failed to watch a path", _))

case class Tailer2(path: os.Path, onLine: String => Unit):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIXME: attempt two at writing a tailer


end pulumi

object Tailer:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIXME: attempt one at creating a tailer

*
* For self-managed backends, the `org` portion of the stack name must always be the constant value `organization`.
*/
opaque type StackName <: String = String
Copy link
Contributor Author

@pawelprazak pawelprazak May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could probably be reused in core in stack references

*
* See: https://github.com/pulumi/pulumi/issues/2522
*/
opaque type FullyQualifiedStackName <: StackName = StackName
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could probably be reused in core in stack references

import scala.language.implicitConversions

/** Name is an identifier. */
opaque type Name <: String = String
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could probably be useful in core and codegen, but would require a separate module, just for model stuff

package besom.model

// TODO: move to separate module
// NOTICE: keep in sync with codegen/src/model/SemanticVersion.scala
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as we don't have a separate model module this was duplicated

@pawelprazak pawelprazak changed the base branch from develop to main May 16, 2024 18:30
import org.virtuslab.yaml.internal.load.parse.EventKind._
import org.virtuslab.yaml.internal.dump.serialize.Serializer

object HackedSerializerImpl extends Serializer {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIXME: this needs to be fixed upstream


private def convertMappingNode(node: Node.MappingNode): Seq[EventKind] = {
val events = node.mappings.toSeq.flatMap {
case (_, Node.ScalarNode(null, _)) => Seq.empty
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the actual change AFAIR, handling null's

@@ -1,6 +1,6 @@
//> using scala "3.3.1"
//> using options "-java-output-version:11", "-Ysafe-init", "-Xmax-inlines:64"
//> using options "-Werror", "-Wunused:all", "-deprecation", "-feature"
//> using options "-Werror", "-Wunused:all", "-deprecation", "-feature", "-Wconf:cat=deprecation:i"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the magic Wconf ignores deprecation warnings from protobuf so the Werror does not blow up

@@ -56,11 +56,6 @@ object Env:
private[internal] def getConfigSecretKeys(key: String): Try[Set[NonEmptyString]] =
Try { sys.env.get(key).map(_.parseJson.convertTo[Set[NonEmptyString]]).getOrElse(Set.empty) }

private[internal] def isTruthy(s: String): Boolean =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to util for reuse

@pawelprazak pawelprazak force-pushed the pprazak/towards-auto-api branch 2 times, most recently from 83d645d to d2e9941 Compare May 17, 2024 07:43
@pawelprazak pawelprazak modified the milestones: 1.0.0, 0.4.0 May 17, 2024
Copy link
Collaborator

@lbialy lbialy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm fn

@lbialy lbialy marked this pull request as ready for review May 22, 2024 10:11
@lbialy lbialy requested a review from prolativ as a code owner May 22, 2024 11:36
@lbialy lbialy merged commit 7161a94 into main May 22, 2024
2 checks passed
@lbialy lbialy deleted the pprazak/towards-auto-api branch May 22, 2024 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/automation-api The Automation API impact/broken Something that is difficult or impossible for some people to use kind/missing We are missing a part of functionality compared to upstream
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants