MCPcopy Create free account
hub / github.com/ddev/ddev / Push

Method Push

pkg/ddevapp/provider.go:155–208  ·  view source on GitHub ↗

Push pushes db and files up to upstream hosting provider

(provider *Provider, skipDBArg bool, skipFilesArg bool)

Source from the content-addressed store, hash-verified

153
154// Push pushes db and files up to upstream hosting provider
155func (app *DdevApp) Push(provider *Provider, skipDBArg bool, skipFilesArg bool) error {
156 var err error
157 err = app.ProcessHooks("pre-push")
158 if err != nil {
159 return fmt.Errorf("failed to process pre-push hooks: %v", err)
160 }
161
162 status, _ := app.SiteStatus()
163 if status != SiteRunning {
164 util.Warning("Project is not currently running. Starting project before performing push.")
165 err = app.Start()
166 if err != nil {
167 return err
168 }
169 }
170
171 if provider.AuthCommand.Command != "" {
172 output.UserOut.Print("Authenticating...")
173 err := provider.app.ExecOnHostOrService(provider.AuthCommand.Service, provider.injectedEnvironment()+"; "+provider.AuthCommand.Command)
174 if err != nil {
175 return err
176 }
177 }
178
179 if skipDBArg {
180 output.UserOut.Println("Skipping database push.")
181 } else {
182 output.UserOut.Println("Uploading database...")
183 err = provider.UploadDB()
184 if err != nil {
185 return err
186 }
187
188 output.UserOut.Printf("Database uploaded")
189 }
190
191 if skipFilesArg {
192 output.UserOut.Println("Skipping files push.")
193 } else {
194 output.UserOut.Println("Uploading files...")
195 err = provider.UploadFiles()
196 if err != nil {
197 return err
198 }
199
200 output.UserOut.Printf("Files uploaded")
201 }
202 err = app.ProcessHooks("post-push")
203 if err != nil {
204 return fmt.Errorf("failed to process post-push hooks: %v", err)
205 }
206
207 return nil
208}
209
210// GetBackup will create and download a set of backups
211// Valid values for backupType are "database" or "files".

Callers 6

TestAcquiaPushFunction · 0.80
TestPantheonPushFunction · 0.80
startAndCheckUpsunPushFunction · 0.80
TestLagoonPushFunction · 0.80
appPushFunction · 0.80

Calls 9

ProcessHooksMethod · 0.95
SiteStatusMethod · 0.95
StartMethod · 0.95
WarningFunction · 0.92
ErrorfMethod · 0.80
ExecOnHostOrServiceMethod · 0.80
injectedEnvironmentMethod · 0.80
UploadDBMethod · 0.80
UploadFilesMethod · 0.80

Tested by 5

TestAcquiaPushFunction · 0.64
TestPantheonPushFunction · 0.64
startAndCheckUpsunPushFunction · 0.64
TestLagoonPushFunction · 0.64