Skip to content

BREAKING - Support packaging and deploying artefacts as separate steps #2473

Closed

Description

@johncmckim

Feature Proposal

Description

For CI / CD scenarios it is common to package and deploy software as separate steps. The package step generates artefacts and the deploy steps deploys those artefacts to different environments. This allows for scenarios like environment promotion ect.

At this stage we sort of have a package step with sls deploy --noDeploy. We might need to consider adding a command like sls package that performs the same task. I remember the discussion around the naming of --noDeploy. Having a separate command was discussed then.

The missing step is a sls deploy --package ./package.zip. This would deploy the package that had been created earlier.

Similar or dependent issues:

Additional Data

  • _Serverless Framework Version_: 1.0.2

Activity

  1. gertjvr commented on Oct 20, 2016

    @gertjvr
    Contributor

    Love this idea. we where thinking about how to resolve this.

    Scenarios for us:

    We use Teamcity for running tests and compiling / building assets. These assets are then package and promoted to be deployed with Octopus Deploy. During deployment OD replaces tokens injected at build time with configuration for the environment its deploying too.

    Making the assets a first-class citizen would make deployments repeatable and controlled.

  2. nicka commented on Oct 20, 2016

    @nicka
    Contributor

    @johncmckim Thanks for documenting the issue. One thing I would like to be clarified though.

    The missing step is a sls deploy --package ./package.zip. This would deploy the package that had been created earlier.

    Would this also take in account the generated CloudFormation templates from an earlier build phase? I'm not really sure if including the templates is really that important though(since they will be autogenerated). Also including the templates would make it provider specific again, while --package should be common among providers.

  3. gertjvr commented on Oct 20, 2016

    @gertjvr
    Contributor

    @nicka it very important for us that nothing changes to the artifacts after they are generated and packaged. As the promotion path requires consistent / unchanged artifacst. As I mentioned in my comment OD will replace tokens injected into the artifacts. if you regenerated them these replaced tokens might get reset.

  4. nicka commented on Oct 20, 2016

    @nicka
    Contributor

    @gertjvr I'm working on a feature proposal #2477 for the use of CloudFormation Change Sets. Since I think it could be two separate deploy arguments.

  5. johncmckim commented on Oct 20, 2016

    @johncmckim
    ContributorAuthor

    @nicka it should include CF but it should also support other providers. This is how I think it should work

    Examples

    Scenario 1 - separate package and deploy

    1. sls package generates the required files. For example:
    |_ .serverless
      |_ cloudformation-template-create-stack.json
      |_ cloudformation-template-update-stack.json
      |_ your-service.zip
    
    1. These files are zipped and stored as an artefact artefact.zip. This can be done by CI or could be done by serverless
    2. sls deploy --package artefact.zip skips the package process, extracts the package to .serverless and deploys .serverless

    Scenario 2 - normal and deploy

    1. sls deploy generates the required files in .serverless and deploys .serverless

    More thoughts

    The implementation I am thinking of is not provider specific. It merely works which .serverless in different ways.

    The reason why I would go with this is that as @gertjvr says, the package should not change between environments (except for environment variables).

    I'm open to suggestions for improving this.

  6. nicka commented on Oct 20, 2016

    @nicka
    Contributor

    @johncmckim Thanks for elaborating on this, sounds and reads 👍

  7. flomotlik commented on Oct 20, 2016

    @flomotlik
    Contributor

    @johncmckim interesting proposal. I'll have to think this through a bit and will come back with my opionion then in the next days.

  8. gertjvr commented on Oct 27, 2016

    @gertjvr
    Contributor

    Any update on this discussion?

  9. lmammino commented on Oct 28, 2016

    @lmammino
    Contributor

    I am also interested in knowing if there is a plan to develop and release these feature.

  10. flomotlik commented on Nov 8, 2016

    @flomotlik
    Contributor

    I just created 3 different new issues after a little more discussion that should solve this by creating a separate build command and documenting how to use the variable system to make this work.

    We need to further discuss during the implementation of those issues how we're dealing with CF templates, if those are created during the build process as well and then just handed to the deploy command, so the deploy command really only deploys but does not do any further building of artifacts.

  11. modified the milestone: 1.3 on Nov 13, 2016
  12. 16 remaining items

  13. pmuens commented on Mar 9, 2017

    @pmuens
    Contributor

    @gertjvr yes, @eahefnawy is currently working on it!

    Furthermore there's @HyperBrain great work with the entrypoint PR (#3327) and the CI / CD plugin (https://github.com/HyperBrain/serverless-cicd) which implements just that.

  14. changed the title [-]Support packaging and deploying artefacts as separate steps[/-] [+]BREAKING - Support packaging and deploying artefacts as separate steps[/+] on Mar 9, 2017
  15. modified the milestones: 1.9, 1.10 on Mar 10, 2017
  16. modified the milestones: 1.11, 1.10 on Mar 29, 2017
  17. modified the milestones: 1.12, 1.11 on Apr 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions