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

Add initial config.yml #47

Merged
merged 39 commits into from
Jul 21, 2017
Merged

Add initial config.yml #47

merged 39 commits into from
Jul 21, 2017

Conversation

warrenvw
Copy link
Contributor

@warrenvw warrenvw commented Jul 7, 2017

Just basic config, used for WIP testing

Just basic config, used for WIP testing
@arm4b
Copy link
Member

arm4b commented Jul 8, 2017

From the resulting config I must admit that placing every new Docker version in a dir doesn't look like ideal way for a long term.
Every time we have a new StackStorm release, - you'll need to edit circle.yml and every time it will pollute circle.yml and with every push to master it will rebuild ALL the images, including old ones.

There are better ways to do this:

  • Build + Tag new Docker image based on new git tag in st2-docker (GitHub release if you want).
  • Build + Tag new Docker image based on pushing a commit to git branch (v2.3.0 v2.3.1, etc).

@warrenvw
Copy link
Contributor Author

@armab Thanks for your feedback. I agree, current WIP is not ideal long term. To date, I've been using this PR as a playground. Caching works really well - builds on CircleCI are at least 8x faster than on Docker Hub.

Additionally, we're not currently building the other images (stackstorm-1ppc, stackstorm-all) when there's a new ST2 version. IMHO, we must handle this case and the ones you've mentioned before I'd consider this PR ready for final review.

@warrenvw
Copy link
Contributor Author

warrenvw commented Jul 10, 2017

Remaining Tasks:

  • Build + Tag docker image based on pushing a new git tag.
  • Ensure stackstorm-1ppc and stackstorm-all are also built and tagged at the same time as the stackstorm image.

@warrenvw warrenvw added RFR and removed WIP labels Jul 13, 2017
@arm4b
Copy link
Member

arm4b commented Jul 14, 2017

Please include the build badge in README.md

name: Install bash
command: apk add --no-cache bash
- deploy:
name: Build and Push image to Docker Hub
Copy link
Member

Choose a reason for hiding this comment

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

Ideally is to divide that single Build & Push into 2 steps: build & push where the build happens as "normal" CircleCI step, while push happens on deploy CircleCI step.

This way it will be more clear what's going on in CircleCI: when the CI just builds an image and when it's actually uploading it to the Hub.

exit 1
fi

docker login --username ${DOCKER_USER} --password ${DOCKER_PASSWORD}
Copy link
Member

@arm4b arm4b Jul 14, 2017

Choose a reason for hiding this comment

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

This line will fail the build in some cases.

Secret env vars set in CircleCI DOCKER_USER and DOCKER_PASSWORD are not available for forked PRs, eg. cases with external contributions (and we want those contributions).

This perfectly works with the previous message when build & deploy steps are separated.
So docker login + docker push should be part of the deployment step, which is triggered only on post-merge or new git tag (GitHub release), while we also build the image to verify Dockerfile corectness on every PR, where docker login is not needed.


MANIFEST="/st2-manifest.txt"

echo "Image built at $(date) using st2-docker:${ST2_DOCKER_SHA1}" > $MANIFEST
Copy link
Member

Choose a reason for hiding this comment

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

st2-docker:${ST2_DOCKER_SHA1}

Can we use the full GitHub link with the SHA1 instead? Could be easier to copy-paste.
At the same time, would be good to include CircleCI build URL as well, like we do in st2 repo.

This way user has all the information: where/how the build happened and which commit it refers to.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Good idea!

Copy link
Member

@arm4b arm4b left a comment

Choose a reason for hiding this comment

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

Thanks for splitting the build & deploy stages 👍

name: Deploy image to Docker Hub
branches:
only:
- feature/circleci
Copy link
Member

Choose a reason for hiding this comment

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

Seems master branch is needed as well.
Also will this work when creating a git tag (GitHub release)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I plan to replace feature/circleci with master before merging and deleting feature/circleci branch.

I've yet to confirm adding a git tag (GitHub release). I'd hoped to do this already, but I'm blocked by CircleCI infra issue. I'll try again tonight. I thought it was a recent commit that broke it, but rebuild of previously successful builds are failing too...

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense 👍

Change the logic that writes /st2-manifest.txt
branches:
  only:
    - master

Even with the above, it deployed with CIRCLE_BRANCH=feature/circleci
@warrenvw warrenvw merged commit 84f6043 into master Jul 21, 2017
@warrenvw warrenvw deleted the feature/circleci branch July 21, 2017 17:01
transhapHigsn pushed a commit to DiligenceVault/st2-docker that referenced this pull request Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants