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

drone(docker-driver): Fetch tags before pushing image during release #10664

Merged
merged 5 commits into from
Sep 21, 2023

Conversation

kavirajk
Copy link
Contributor

What this PR does / why we need it:
We realized, loki-docker-driver image was not being pushed after 2.8.2. And looking into it's drone pipeline and comparing it with other steps, docker-driver step is not fetching the tags, thus the final hash calculated to push is some HEAD branch.

e.g: even if we have tag 2.9.1, it pushes only with latest HEAD commit hash.

This PR fixes it.
Screenshot 2023-09-21 at 08 14 09
Screenshot 2023-09-21 at 08 14 24
Screenshot 2023-09-21 at 08 14 42

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:
I would prefer this instead of #10663. Because that would make fetching tags more repetitive in all the drone tasks (can also be expensive in terms of running time if we put all together)

Checklist

We realized, loki-docker-driver image was not being pushed after 2.8.2. And looking into it's drone pipeline and comparing it with other steps, docker-driver step is not
fetching the tags, thus the final hash calculated to push is some HEAD branch.

e.g: even if we have tag 2.9.1, it pushes only with latest HEAD commit hash.

This PR fixes it.

Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
@kavirajk kavirajk requested a review from a team as a code owner September 21, 2023 06:16
Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
@@ -917,6 +916,7 @@ local manifest_ecr(apps, archs) = pipeline('manifest-ecr') {
DOCKER_PASSWORD: { from_secret: docker_password_secret.name },
},
commands: [
'git fetch origin --tags',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

tried one more approach before this.

Tried to add it as separate step say fetch-git-tags on this pipeline. In that case, git tags only fetched in that particular step and cannot be used during make docker-driver-push step. Rationale being other pipelines that do use separate step to fetch git tags, stores it in ./tools/image-tag > arch.tags and re-use it other step.

Ended up doing this way without changing much of the pipelines.

Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

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

LGTM but you'll need to update the drone signature

Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
@kavirajk kavirajk enabled auto-merge (squash) September 21, 2023 08:04
@kavirajk kavirajk merged commit 8721e41 into main Sep 21, 2023
@kavirajk kavirajk deleted the kavirajk/docker-driver-drone-push-right-tags branch September 21, 2023 08:24
@grafanabot
Copy link
Collaborator

The backport to release-2.8.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-10664-to-release-2.8.x origin/release-2.8.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 8721e41c6c36910d60cdc2c1253bded0058fd493
# When the conflicts are resolved, stage and commit the changes
git add . && git cherry-pick --continue

If you have the GitHub CLI installed:

# Push the branch to GitHub:
git push --set-upstream origin backport-10664-to-release-2.8.x
# Create the PR body template
PR_BODY=$(gh pr view 10664 --json body --template 'Backport 8721e41c6c36910d60cdc2c1253bded0058fd493 from #10664{{ "\n\n---\n\n" }}{{ index . "body" }}')
# Create the PR on GitHub
echo "${PR_BODY}" | gh pr create --title "[release-2.8.x] drone(docker-driver): Fetch tags before pushing image during release" --body-file - --label "size/XS" --label "type/bug" --label "backport" --base release-2.8.x --milestone release-2.8.x --web

Or, if you don't have the GitHub CLI installed (we recommend you install it!):

# Push the branch to GitHub:
git push --set-upstream origin backport-10664-to-release-2.8.x

# Create a pull request where the `base` branch is `release-2.8.x` and the `compare`/`head` branch is `backport-10664-to-release-2.8.x`.

# Remove the local backport branch
git switch main
git branch -D backport-10664-to-release-2.8.x

kavirajk added a commit that referenced this pull request Sep 21, 2023
…10664)

**What this PR does / why we need it**:
We realized, loki-docker-driver image was not being pushed after 2.8.2.
And looking into it's drone pipeline and comparing it with other steps,
docker-driver step is not fetching the tags,[ thus the final hash
calculated to push is some HEAD
branch.](https://github.com/grafana/loki/blob/main/tools/image-tag#L13-L14)

e.g: even if we have tag 2.9.1, it pushes only with latest HEAD commit
hash.

This PR fixes it.
![Screenshot 2023-09-21 at 08 14
09](https://github.com/grafana/loki/assets/3735252/31e4d031-d22f-4bed-8aa7-3e6136a6f10c)
![Screenshot 2023-09-21 at 08 14
24](https://github.com/grafana/loki/assets/3735252/1742b821-58a3-4ef5-96ae-80304126b8cb)
![Screenshot 2023-09-21 at 08 14
42](https://github.com/grafana/loki/assets/3735252/5e060eeb-e57a-4124-b29b-bc8ce73cc6d9)

**Which issue(s) this PR fixes**:
Fixes #<issue number>

**Special notes for your reviewer**:
I would prefer this instead of
#10663. Because that would make
fetching tags more repetitive in all the drone tasks (can also be
expensive in terms of running time if we put all together)

**Checklist**
- [x] Reviewed the
[`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md)
guide (**required**)

---------

Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
(cherry picked from commit 8721e41)
Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
kavirajk added a commit that referenced this pull request Sep 21, 2023
…10670)

backport #10664 to `2.8.x` branch

Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
kavirajk added a commit that referenced this pull request Sep 21, 2023
…10664)

**What this PR does / why we need it**:
We realized, loki-docker-driver image was not being pushed after 2.8.2.
And looking into it's drone pipeline and comparing it with other steps,
docker-driver step is not fetching the tags,[ thus the final hash
calculated to push is some HEAD
branch.](https://github.com/grafana/loki/blob/main/tools/image-tag#L13-L14)

e.g: even if we have tag 2.9.1, it pushes only with latest HEAD commit
hash.

This PR fixes it.
![Screenshot 2023-09-21 at 08 14
09](https://github.com/grafana/loki/assets/3735252/31e4d031-d22f-4bed-8aa7-3e6136a6f10c)
![Screenshot 2023-09-21 at 08 14
24](https://github.com/grafana/loki/assets/3735252/1742b821-58a3-4ef5-96ae-80304126b8cb)
![Screenshot 2023-09-21 at 08 14
42](https://github.com/grafana/loki/assets/3735252/5e060eeb-e57a-4124-b29b-bc8ce73cc6d9)

**Which issue(s) this PR fixes**:
Fixes #<issue number>

**Special notes for your reviewer**:
I would prefer this instead of
#10663. Because that would make
fetching tags more repetitive in all the drone tasks (can also be
expensive in terms of running time if we put all together)

**Checklist**
- [x] Reviewed the
[`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md)
guide (**required**)

---------

Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
(cherry picked from commit 8721e41)
kavirajk added a commit that referenced this pull request Sep 21, 2023
rhnasc pushed a commit to inloco/loki that referenced this pull request Apr 12, 2024
…rafana#10664)

**What this PR does / why we need it**:
We realized, loki-docker-driver image was not being pushed after 2.8.2.
And looking into it's drone pipeline and comparing it with other steps,
docker-driver step is not fetching the tags,[ thus the final hash
calculated to push is some HEAD
branch.](https://github.com/grafana/loki/blob/main/tools/image-tag#L13-L14)

e.g: even if we have tag 2.9.1, it pushes only with latest HEAD commit
hash.

This PR fixes it.
![Screenshot 2023-09-21 at 08 14
09](https://github.com/grafana/loki/assets/3735252/31e4d031-d22f-4bed-8aa7-3e6136a6f10c)
![Screenshot 2023-09-21 at 08 14
24](https://github.com/grafana/loki/assets/3735252/1742b821-58a3-4ef5-96ae-80304126b8cb)
![Screenshot 2023-09-21 at 08 14
42](https://github.com/grafana/loki/assets/3735252/5e060eeb-e57a-4124-b29b-bc8ce73cc6d9)

**Which issue(s) this PR fixes**:
Fixes #<issue number>

**Special notes for your reviewer**:
I would prefer this instead of
grafana#10663. Because that would make
fetching tags more repetitive in all the drone tasks (can also be
expensive in terms of running time if we put all together)

**Checklist**
- [x] Reviewed the
[`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md)
guide (**required**)

---------

Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
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.

3 participants