Remove references to Pulumi private clouds (#2095)
* Remove TODO for issue since fixed in PPCs. * Update issue reference to source * Update comment wording * Remove --ppc arg of stack init * Remove PPC references in int. testing fx * Remove vestigial PPC API types
This commit is contained in:
parent
b14d259365
commit
f324a460e9
|
@ -8,5 +8,5 @@ make ensure
|
|||
$(go env GOPATH)/src/github.com/pulumi/scripts/ci/check-worktree-is-clean.sh
|
||||
|
||||
# Set stdout back to blocking to avoid problems writing large outputs.
|
||||
# https://github.com/pulumi/pulumi-ppc/issues/176
|
||||
# https://github.com/travis-ci/travis-ci/issues/4704
|
||||
python -c 'import fcntl, os, sys; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); print("stdout was " + ("nonblocking" if flags & os.O_NONBLOCK else "blocking")); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags & ~os.O_NONBLOCK)'
|
||||
|
|
|
@ -19,12 +19,10 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/pulumi/pulumi/pkg/backend/display"
|
||||
"github.com/pulumi/pulumi/pkg/backend/httpstate"
|
||||
"github.com/pulumi/pulumi/pkg/util/cmdutil"
|
||||
)
|
||||
|
||||
func newStackInitCmd() *cobra.Command {
|
||||
var ppc string
|
||||
cmd := &cobra.Command{
|
||||
Use: "init [<organization-name>/]<stack-name>",
|
||||
Args: cmdutil.MaximumNArgs(1),
|
||||
|
@ -46,13 +44,6 @@ func newStackInitCmd() *cobra.Command {
|
|||
return err
|
||||
}
|
||||
|
||||
var createOpts interface{}
|
||||
if _, ok := b.(httpstate.Backend); ok {
|
||||
createOpts = httpstate.CreateStackOptions{
|
||||
CloudName: ppc,
|
||||
}
|
||||
}
|
||||
|
||||
var stackName string
|
||||
if len(args) > 0 {
|
||||
stackName = args[0]
|
||||
|
@ -73,11 +64,10 @@ func newStackInitCmd() *cobra.Command {
|
|||
return err
|
||||
}
|
||||
|
||||
var createOpts interface{} // Backend-specific config options, none currently.
|
||||
_, err = createStack(b, stackRef, createOpts, true /*setCurrent*/)
|
||||
return err
|
||||
}),
|
||||
}
|
||||
cmd.PersistentFlags().StringVarP(
|
||||
&ppc, "ppc", "p", "", "An optional Pulumi Private Cloud (PPC) name to initialize this stack in")
|
||||
return cmd
|
||||
}
|
||||
|
|
|
@ -257,8 +257,7 @@ const (
|
|||
|
||||
// Stack describes a Stack running on a Pulumi Cloud.
|
||||
type Stack struct {
|
||||
CloudName string `json:"cloudName"`
|
||||
OrgName string `json:"orgName"`
|
||||
OrgName string `json:"orgName"`
|
||||
|
||||
RepoName string `json:"repoName"`
|
||||
ProjectName string `json:"projName"`
|
||||
|
|
|
@ -25,9 +25,3 @@ type LogEntry struct {
|
|||
Timestamp int64 `json:"timestamp"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// GetStackLogsResponse describes the data returned by the `GET /stack/{stackID}/logs` endpoint of the PPC API.
|
||||
type GetStackLogsResponse struct {
|
||||
// LogEntries records the sequence of log entries generated by the stack's resources.
|
||||
LogEntries []LogEntry `json:"logEntries"`
|
||||
}
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
|
||||
package apitype
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// StackSummary describes the state of a stack, without including its specific resources, etc.
|
||||
type StackSummary struct {
|
||||
// OrgName is the organization name the stack is found in.
|
||||
|
@ -35,56 +33,16 @@ type ListStacksResponse struct {
|
|||
Stacks []StackSummary `json:"stacks"`
|
||||
}
|
||||
|
||||
// CreateStackResponseByID describes the data returned by the `POST /stacks` endpoint of the PPC API.
|
||||
type CreateStackResponseByID struct {
|
||||
// ID is the unique identifier for the newly-created stack.
|
||||
ID string `json:"id"`
|
||||
}
|
||||
|
||||
// CreateStackRequest defines the request body for creating a new Stack
|
||||
type CreateStackRequest struct {
|
||||
// If empty means use the default cloud.
|
||||
CloudName string `json:"cloudName"`
|
||||
// The rest of the StackIdentifier (repo, project) is in the URL.
|
||||
StackName string `json:"stackName"`
|
||||
// An optional set of tags to apply to the stack.
|
||||
Tags map[StackTagName]string `json:"tags,omitEmpty"`
|
||||
}
|
||||
|
||||
// CreateStackResponseByName is the response from a create Stack request.
|
||||
type CreateStackResponseByName struct {
|
||||
// The name of the cloud used if the default was sent.
|
||||
CloudName string `json:"cloudName"`
|
||||
}
|
||||
|
||||
// GetStackResponse describes the data returned by the `/GET /stack/{stackID}` endpoint of the PPC API. If the
|
||||
// `deployment` query parameter is set to `true`, `Deployment` will be set and `Resources will be empty.
|
||||
type GetStackResponse struct {
|
||||
// ID is the unique identifier for a stack in the context of its PPC.
|
||||
ID string `json:"id"`
|
||||
|
||||
// ActiveUpdate is the unique identifier for the stack's active update. This may be empty if no update has
|
||||
// been applied.
|
||||
ActiveUpdate string `json:"activeUpdate"`
|
||||
|
||||
// UnknownState indicates whether or not the contents of the resources array contained in the response is
|
||||
// known to accurately represent the cloud resources managed by this stack. A stack that is in an unknown
|
||||
// state cannot be updated.
|
||||
// TODO: [pulumi/pulumi-ppc#29]: make this state recoverable. This could be as simple as import/export.
|
||||
UnknownState bool `json:"unknownState"`
|
||||
|
||||
// Version indicates the schema of the Resources, Manifest, and Deployment fields below.
|
||||
Version int `json:"version"`
|
||||
|
||||
// Resources provides the list of cloud resources managed by this stack.
|
||||
Resources []ResourceV1 `json:"resources"`
|
||||
|
||||
// Manifest is the Manifest from the last rendered checkpoint.
|
||||
Manifest ManifestV1 `json:"manifest"`
|
||||
|
||||
// Deployment provides a view of the stack as an opaque Pulumi deployment.
|
||||
Deployment json.RawMessage `json:"deployment,omitempty"`
|
||||
}
|
||||
// CreateStackResponse is the response from a create Stack request.
|
||||
type CreateStackResponse struct{}
|
||||
|
||||
// EncryptValueRequest defines the request body for encrypting a value.
|
||||
type EncryptValueRequest struct {
|
||||
|
|
|
@ -170,92 +170,6 @@ type UpdateProgram struct {
|
|||
Refresh bool `json:"refresh"`
|
||||
}
|
||||
|
||||
// CreateUpdateRequest describe the data provided as the body of a request to the `POST /updates` endpoint of
|
||||
// the PPC API.
|
||||
type CreateUpdateRequest struct {
|
||||
// Stack is the unqique ID for the stack that this update targets.
|
||||
Stack string `json:"stack"`
|
||||
|
||||
// Import indicates whether or not this update's resources are given by a checkpoint to import rather than
|
||||
// an actual Pulumi program. If this field is `true`, the client must upload the checkpoint file to the
|
||||
// URL returned in the response. Config should be empty, as it will be copied from the base update. Program
|
||||
// should also be empty, as it will not be used.
|
||||
IsCheckpointImport bool `json:"import,omitempty"`
|
||||
|
||||
// StackAlias is the friendly name for the update's stack that will be exposed to the update's Pulumi
|
||||
// program.
|
||||
StackAlias string `json:"stackAlias,omitempty"`
|
||||
|
||||
// Config records the configuration values for an update. Must be nil if IsCheckpointImport is true.
|
||||
Config *CreateUpdateConfig `json:"config,omitempty"`
|
||||
|
||||
// Program records the program metadata for an update. Must be nil if IsCheckpointImport is true.
|
||||
Program *UpdateProgram `json:"program,omitempty"`
|
||||
}
|
||||
|
||||
// CreateUpdateResponse describes the data returned by a request to the `POST /updates` endpoint of the PPC
|
||||
// API.
|
||||
type CreateUpdateResponse struct {
|
||||
// ID is the unique identifier of the newly-created update.
|
||||
ID string `json:"id"`
|
||||
|
||||
// Stack is the unique identifier of the stack targeted by the update.
|
||||
Stack string `json:"stack"`
|
||||
|
||||
// BaseUpdate is the unique identifier of the update that was active in the stack indicated above at the
|
||||
// time at which this update was created.
|
||||
BaseUpdate string `json:"baseUpdate"`
|
||||
|
||||
// UploadURL is a URL that the client must use to upload the contents of the program associated with this
|
||||
// update. The client should upload the program by sending a `PUT` request to this URL with the contents of
|
||||
// the program as a ZIP file in the request body. The `PUT` request must also set the `Content-Length`
|
||||
// header.
|
||||
UploadURL string `json:"uploadURL"`
|
||||
}
|
||||
|
||||
// UpdateApplyRequest describes the data provided as the body of a request to the `POST
|
||||
// /updates/{updateID}/apply` and `POST /updates/{updateID}/preview` endpoints of the PPC API.
|
||||
type UpdateApplyRequest struct {
|
||||
// Should we tell the engine to emit information about the configuration during this update.
|
||||
ShowConfig bool `json:"showConfig,omitempty"`
|
||||
|
||||
// Should we tell the engine to emit information about resources that have not changed during this update.
|
||||
ShowSames bool `json:"showSames,omitempty"`
|
||||
|
||||
// Should we tell the engine to emit information about replacement steps during this update.
|
||||
ShowReplacementSteps bool `json:"showReplacementSteps,omitempty"`
|
||||
|
||||
// Should we tell the engine to emit summary information during this update.
|
||||
Summary bool `json:"summary,omitempty"`
|
||||
}
|
||||
|
||||
// GetUpdateResponse describes the data retuerned by a request to the `GET /updates/{updateID}` endpoint of the
|
||||
// PPC API.
|
||||
type GetUpdateResponse struct {
|
||||
CreateUpdateResponse
|
||||
|
||||
// State indicates which state the update is in.
|
||||
State string `json:"state"`
|
||||
|
||||
// StackAlias is the friendly name for the update's stack that will be exposed to the update's Pulumi
|
||||
// program.
|
||||
StackAlias string `json:"stackAlias,omitempty"`
|
||||
|
||||
// Config records the configuration values for an update.
|
||||
Config map[string]string `json:"config"`
|
||||
|
||||
// Program records the program metadata for an update.
|
||||
Program UpdateProgram `json:"program"`
|
||||
}
|
||||
|
||||
// GetApplyUpdateResultsResponse describes the data returned by the `GET /updates/{updateID}/apply` endpoint of
|
||||
// the PPC API.
|
||||
type GetApplyUpdateResultsResponse UpdateResults
|
||||
|
||||
// GetPreviewUpdateResultsResponse describes the data returned by the `GET /updates/{updateID}/preview`
|
||||
// endpoint of the PPC API.
|
||||
type GetPreviewUpdateResultsResponse UpdateResults
|
||||
|
||||
// RenewUpdateLeaseRequest defines the body of a request to the update lease renewal endpoint of the service API.
|
||||
type RenewUpdateLeaseRequest struct {
|
||||
// The current, valid lease token.
|
||||
|
|
|
@ -501,24 +501,9 @@ func (b *cloudBackend) GetStack(ctx context.Context, stackRef backend.StackRefer
|
|||
return newStack(stack, b), nil
|
||||
}
|
||||
|
||||
// CreateStackOptions is an optional bag of options specific to creating cloud stacks.
|
||||
type CreateStackOptions struct {
|
||||
// CloudName is the optional PPC name to create the stack in. If omitted, the organization's default PPC is used.
|
||||
CloudName string
|
||||
}
|
||||
|
||||
func (b *cloudBackend) CreateStack(ctx context.Context, stackRef backend.StackReference,
|
||||
opts interface{}) (backend.Stack, error) {
|
||||
|
||||
if opts == nil {
|
||||
opts = CreateStackOptions{}
|
||||
}
|
||||
|
||||
cloudOpts, ok := opts.(CreateStackOptions)
|
||||
if !ok {
|
||||
return nil, errors.New("expected a CloudStackOptions value for opts parameter")
|
||||
}
|
||||
|
||||
func (b *cloudBackend) CreateStack(
|
||||
ctx context.Context, stackRef backend.StackReference, _ interface{} /* No custom options for httpstate backend. */) (
|
||||
backend.Stack, error) {
|
||||
stackID, err := b.getCloudStackIdentifier(stackRef)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -529,7 +514,7 @@ func (b *cloudBackend) CreateStack(ctx context.Context, stackRef backend.StackRe
|
|||
return nil, errors.Wrap(err, "error determining initial tags")
|
||||
}
|
||||
|
||||
apistack, err := b.client.CreateStack(ctx, stackID, cloudOpts.CloudName, tags)
|
||||
apistack, err := b.client.CreateStack(ctx, stackID, tags)
|
||||
if err != nil {
|
||||
// If the status is 409 Conflict (stack already exists), return StackAlreadyExistsError.
|
||||
if errResp, ok := err.(*apitype.ErrorResponse); ok && errResp.Code == http.StatusConflict {
|
||||
|
@ -1144,7 +1129,6 @@ func (b *cloudBackend) tryNextUpdate(ctx context.Context, update client.UpdateId
|
|||
// If our request to the Pulumi Service returned a 504 (Gateway Timeout), ignore it and keep
|
||||
// continuing. The sole exception is if we've done this 10 times. At that point, we will have
|
||||
// been waiting for many seconds, and want to let the user know something might be wrong.
|
||||
// TODO(pulumi/pulumi-ppc/issues/60): Elminate these timeouts all together.
|
||||
if try < 10 {
|
||||
warn = false
|
||||
}
|
||||
|
|
|
@ -214,32 +214,28 @@ func (pc *Client) GetStack(ctx context.Context, stackID StackIdentifier) (apityp
|
|||
|
||||
// CreateStack creates a stack with the given cloud and stack name in the scope of the indicated project.
|
||||
func (pc *Client) CreateStack(
|
||||
ctx context.Context, stackID StackIdentifier, cloudName string,
|
||||
tags map[apitype.StackTagName]string) (apitype.Stack, error) {
|
||||
ctx context.Context, stackID StackIdentifier, tags map[apitype.StackTagName]string) (apitype.Stack, error) {
|
||||
// Validate names and tags.
|
||||
if err := backend.ValidateStackProperties(stackID.Stack, tags); err != nil {
|
||||
return apitype.Stack{}, errors.Wrap(err, "validating stack properties")
|
||||
}
|
||||
|
||||
stack := apitype.Stack{
|
||||
CloudName: cloudName,
|
||||
StackName: tokens.QName(stackID.Stack),
|
||||
OrgName: stackID.Owner,
|
||||
Tags: tags,
|
||||
}
|
||||
createStackReq := apitype.CreateStackRequest{
|
||||
CloudName: cloudName,
|
||||
StackName: stackID.Stack,
|
||||
Tags: tags,
|
||||
}
|
||||
|
||||
var createStackResp apitype.CreateStackResponseByName
|
||||
var createStackResp apitype.CreateStackResponse
|
||||
if err := pc.restCall(
|
||||
ctx, "POST", fmt.Sprintf("/api/stacks/%s", stackID.Owner), nil, &createStackReq, &createStackResp); err != nil {
|
||||
return apitype.Stack{}, err
|
||||
}
|
||||
|
||||
stack.CloudName = createStackResp.CloudName
|
||||
return stack, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,6 @@ func RunCommand(t *testing.T, name string, args []string, wd string, opts *Progr
|
|||
TestName: filepath.Base(opts.Dir),
|
||||
IsError: runerr != nil,
|
||||
CloudURL: opts.CloudURL,
|
||||
CloudPPC: opts.PPCName,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -101,8 +101,6 @@ type TestCommandStats struct {
|
|||
IsError bool `json:"isError"`
|
||||
// The Cloud that the test was run against, or empty for local deployments
|
||||
CloudURL string `json:"cloudURL"`
|
||||
// The PPC that the test was run against, or empty for local deployments or for the default PPC
|
||||
CloudPPC string `json:"cloudPPC"`
|
||||
}
|
||||
|
||||
// TestStatsReporter reports results and metadata from a test run.
|
||||
|
@ -152,9 +150,6 @@ type ProgramTestOptions struct {
|
|||
// CloudURL is an optional URL to override the default Pulumi Service API (https://api.pulumi-staging.io). The
|
||||
// PULUMI_ACCESS_TOKEN environment variable must also be set to a valid access token for the target cloud.
|
||||
CloudURL string
|
||||
// PPCName is the name of the PPC to use when running a test against the hosted service. If
|
||||
// not set, the --ppc flag will not be set on `pulumi stack init`.
|
||||
PPCName string
|
||||
|
||||
// StackName allows the stack name to be explicitly provided instead of computed from the
|
||||
// environment during tests.
|
||||
|
@ -285,9 +280,6 @@ func (opts ProgramTestOptions) With(overrides ProgramTestOptions) ProgramTestOpt
|
|||
if overrides.CloudURL != "" {
|
||||
opts.CloudURL = overrides.CloudURL
|
||||
}
|
||||
if overrides.PPCName != "" {
|
||||
opts.PPCName = overrides.PPCName
|
||||
}
|
||||
if overrides.Tracing != "" {
|
||||
opts.Tracing = overrides.Tracing
|
||||
}
|
||||
|
@ -624,14 +616,6 @@ func (pt *programTester) testLifeCycleInitialize(dir string) error {
|
|||
}
|
||||
}
|
||||
|
||||
// Set the target PPC from an environment variable if not overridden in options.
|
||||
if pt.opts.PPCName == "" {
|
||||
ppcName := os.Getenv("PULUMI_API_PPC_NAME")
|
||||
if ppcName != "" {
|
||||
pt.opts.PPCName = ppcName
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure all links are present, the stack is created, and all configs are applied.
|
||||
fprintf(pt.opts.Stdout, "Initializing project (dir %s; stack %s)\n", dir, stackName)
|
||||
|
||||
|
@ -653,8 +637,6 @@ func (pt *programTester) testLifeCycleInitialize(dir string) error {
|
|||
|
||||
// Stack init
|
||||
stackInitArgs := []string{"stack", "init", string(pt.opts.GetStackNameWithOwner())}
|
||||
stackInitArgs = addFlagIfNonNil(stackInitArgs, "--ppc", pt.opts.PPCName)
|
||||
|
||||
if err := pt.runPulumiCommand("pulumi-stack-init", stackInitArgs, dir); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -122,23 +122,6 @@ func addDirectoryToZip(writer *zip.Writer, root string, dir string,
|
|||
}
|
||||
|
||||
if info.Mode().IsDir() {
|
||||
// Work around an issue that will be addressed by pulumi/pulumi-ppc#95, by ensuring
|
||||
// our zip files contain directory entries instead of just having files with paths.
|
||||
// When the PPC fix is everywhere, we can delete this code in favor of just calling
|
||||
// addDirectoryToZip recursively
|
||||
zh, err := zip.FileInfoHeader(info)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Add a trailing slash since this is a directory.
|
||||
zh.Name = convertPathsForZip(strings.TrimPrefix(fullName, root)) + "/"
|
||||
|
||||
_, err = writer.CreateHeader(zh)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = addDirectoryToZip(writer, root, fullName, useDefaultIgnores, ignores)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -85,13 +85,13 @@ if ! tar -zcf "${SDK_PACKAGE_PATH}" pulumi; then
|
|||
fi
|
||||
|
||||
echo "${SDK_PACKAGE_PATH}"
|
||||
# rel.pulumi.com is in our production account, so assume that role first
|
||||
# rel.pulumi.com is in our production account, so assume that role first.
|
||||
readonly CREDS_JSON=$(aws sts assume-role \
|
||||
--role-arn "arn:aws:iam::058607598222:role/UploadPulumiReleases" \
|
||||
--role-session-name "upload-sdk" \
|
||||
--external-id "upload-pulumi-release")
|
||||
|
||||
# Use these new credentials to create the PPC user account.
|
||||
# Extract the assumed role's credentials into specific env vars.
|
||||
AWS_ACCESS_KEY_ID=$(echo "${CREDS_JSON}" | jq ".Credentials.AccessKeyId" --raw-output)
|
||||
export AWS_ACCESS_KEY_ID
|
||||
|
||||
|
|
Loading…
Reference in a new issue